Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

PostgreSQL adapter doesn't allow spaces in table names if no schema or quotes #26721

Closed
Jerph opened this issue Oct 6, 2016 · 1 comment
Closed

Comments

@Jerph
Copy link

Jerph commented Oct 6, 2016

Steps to reproduce

Create, attempt to use, or schema-dump a PostgreSQL table with a space in the name, e.g. create_table 'work orders'.

Expected behavior

It should treat the entire string as the table name.

Actual behavior

It uses the first word or segment before the space as the schema, and the rest as the table name.

This is a bug in the regex used for parsing the schema/table name. You can work around it by using quotes ("work orders"), which is reasonable and necessary when you specify a schema ('"my_schema"."work orders"). It is not necessary for the mysql or sqlite adapters, though, and causes friction when you don't use schemas.

System configuration

Rails version: tested with 4.2.7 and master, probably introduced here

Ruby version: 2.3.1

@maclover7
Copy link
Contributor

maclover7 commented Oct 6, 2016

Per discussion in #26722, the plan is to issue a warning if there is a space in the table name.

cc @matthewd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants