#158 tableExists query issues with uper case table names

closed-wont-fix
Postgres (36)
5
2006-08-22
2006-02-10
Hootbah
No

Its is possible for the tableExists query not to find a
table when it does actually exist.

When using uppercase names e.g.

class sqlmeta:
table = 'MYTABLE'

The tableExists query becomes:

SELECT COUNT(relname) FROM pg_class WHERE relname =
'MYTABLE'

This fails to find the table as the table names stored
within pg_class are all lower case.

I propose to change the query to be:

SELECT COUNT(relname) FROM pg_class WHERE relname =
lower('MYTABLE')

This would mean a change to pgconnection.py:

result = self.queryOne("SELECT COUNT(relname) FROM
pg_class WHERE relname = lower(%s)"
% self.sqlrepr(tableName))

Discussion

  • Oleg Broytman

    Oleg Broytman - 2006-03-27
    • assigned_to: nobody --> phd
    • status: open --> open-wont-fix
     
  • Oleg Broytman

    Oleg Broytman - 2006-03-27

    Logged In: YES
    user_id=4799

    The fix would break case-sensitive names. You don't want to
    make this lowercase:

    class sqlmeta:
    table = '"MYTABLE"'

    Instead just write the name lower-cased:

    class sqlmeta:
    table = 'mytable'

     
  • Oleg Broytman

    Oleg Broytman - 2006-08-22
    • status: open-wont-fix --> closed-wont-fix
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks