Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

wrap tablespace name into quotes #177

Closed
wants to merge 2 commits into from
Closed

wrap tablespace name into quotes #177

wants to merge 2 commits into from

Conversation

kstep
Copy link

@kstep kstep commented Apr 10, 2018

When a tablespace has some special characters (like hyphen "-"), the generated SQL produces syntax error. To avoid it, tablespace name should be wrapped into double quotes.


This change is Reviewable

kstep and others added 2 commits April 10, 2018 14:05
When a tablespace has some special characters (like hyphen "-"), the generated SQL produces syntax error. To avoid it, tablespace name should be wrapped into double quotes.
@dvarrazzo
Copy link
Member

This patch is still broken if the namespace contains ". If you want to protect your dashes you should create a patch based on quote_ident().

There is also no test showing the program didn't work before and works after your patch.

@schmiddy
Copy link
Member

And I think the current behavior is actually kind of intentional -- user-specified command-line parameters such as table name, index name, tablespace, etc. must be quoted appropriately by the user. This is admittedly odd behavior, but AFAIR it's exactly how command-line Postgres utilities such as clusterdb, vacuumdb, etc. work.

@dvarrazzo
Copy link
Member

Yes, I think identifier names are expected to be quoted and that this is uniformly the behaviour of postgres command line tool. Otherwise you couldn't tell if foo.bar is the table bar in the namespace foo or a table called foo.bar in a namespace on the path.

Closing

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants