Skip to content

inappropriate lower() call against table name in PG dialect #2256

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

Closed
sqlalchemy-bot opened this issue Aug 12, 2011 · 5 comments
Closed

inappropriate lower() call against table name in PG dialect #2256

sqlalchemy-bot opened this issue Aug 12, 2011 · 5 comments
Labels
bug Something isn't working postgresql
Milestone

Comments

@sqlalchemy-bot
Copy link
Collaborator

Migrated issue, originally created by Anonymous

Just caught this little bugger:

def has_table(self, connection, table_name, schema=None):
    # seems like case gets folded in pg_class...
    if schema is None:
        cursor = connection.execute(
            sql.text(
            "select relname from pg_class c join pg_namespace n on "
            "n.oid=c.relnamespace where n.nspname=current_schema() and "
            "lower(relname)=:name",
            bindparams=[                       sql.bindparam('name', unicode(**table_name.lower()**),
                    type_=sqltypes.Unicode)](

)
)
)

This results in a failure when trying to work with a table named FOO when a table named foo is already in the database. Postgres at least allows both versions to coexist.

@sqlalchemy-bot
Copy link
Collaborator Author

Michael Bayer (@zzzeek) wrote:

its not immediately clear if that's going to break things for folks who are relying upon it. Have you run the full test suite against PG to ensure everything continues passing ?

@sqlalchemy-bot
Copy link
Collaborator Author

Changes by Michael Bayer (@zzzeek):

  • removed labels: access
  • added labels: postgres
  • set assignee to "zzzeek"
  • set milestone to "0.7.3"

@sqlalchemy-bot
Copy link
Collaborator Author

Changes by Michael Bayer (@zzzeek):

  • changed title from "sqlalchemy incorrectly reports tables as existing " to "inappropriate lower() call against table name in P"

@sqlalchemy-bot
Copy link
Collaborator Author

Michael Bayer (@zzzeek) wrote:

There was the assumption of lower() throughout that code including for sequences - that code was all contributed some years ago. Test coverage has been added along with removal of all lower() directives in 8438477 thanks for the patch !

@sqlalchemy-bot
Copy link
Collaborator Author

Changes by Michael Bayer (@zzzeek):

  • changed status to closed

@sqlalchemy-bot sqlalchemy-bot added postgresql bug Something isn't working labels Nov 27, 2018
@sqlalchemy-bot sqlalchemy-bot added this to the 0.7.3 milestone Nov 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working postgresql
Projects
None yet
Development

No branches or pull requests

1 participant