inappropriate lower() call against table name in PG dialect
Issue #2256
resolved
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.
Comments (4)
-
repo owner -
repo owner - changed title to inappropriate lower() call against table name in PG dialect
-
repo owner - changed status to resolved
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 843847740c7fd3705cb7804ac62914b9a77dc174 thanks for the patch !
-
repo owner - removed milestone
Removing milestone: 0.7.3 (automated comment)
- Log in to comment
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 ?