Opened 5 years ago
Last modified 5 years ago
#13140 closed defect
get_table_names() and get_column_names() wrongly return an empty list when schema is not used on PostgreSQL — at Initial Version
Reported by: | Jun Omae | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | 1.0.18 |
Component: | database backend | Version: | 1.0.17 |
Severity: | normal | Keywords: | postgresql |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
Python 2.5.6 (r256:88840, Oct 21 2014, 22:49:55) [GCC 4.8.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from trac.env import Environment >>> from trac.db.api import DatabaseManager >>> env = Environment('/dev/shm/postgres-without-schema') >>> dbm = DatabaseManager(env) >>> dbm.connection_uri u'postgres://tracuser:password@127.1/tractest' >>> with env.db_query as db: ... db.get_table_names() ... [] >>> with env.db_query as db: ... db.get_column_names('wiki') ... [] >>> env.db_query(""" ... SELECT table_name FROM information_schema.tables ... WHERE table_schema=current_schema() ... ORDER BY table_name ... """) [(u'attachment',), (u'auth_cookie',), (u'cache',), (u'component',), (u'enum',), (u'milestone',), (u'node_change',), (u'permission',), (u'report',), (u'repository',), (u'revision',), (u'session',), (u'session_attribute',), (u'system',), (u'ticket',), (u'ticket_change',), (u'ticket_custom',), (u'version',), (u'wiki',)] >>> env.db_query(""" ... SELECT column_name FROM information_schema.columns ... WHERE table_schema=current_schema() AND table_name=%s ... """, ('wiki',)) [(u'readonly',), (u'comment',), (u'text',), (u'ipnr',), (u'author',), (u'time',), (u'version',), (u'name',)]
Note:
See TracTickets
for help on using tickets.