Sunday, February 19, 2012

how can i get a list of tables ?

hello,
i would to know, in PHP, while i'm conencting to a postgreSQL database, i can get a list of the table which are in ?
is there a global syntax SQL ?
also, i know in MySQL, it is with :
SHOW TABLE STATUS FROM mydbase
how do with postgre ?Maybe if you post this question in the PostgreSQL forum?
:confused:|||Hello,

use the following SQL statement

SELECT relname FROM pg_class WHERE relkind = 'r' AND
relowner = YOURDBIDENTIFIER
ORDER BY relname

Where YOURDBIDENTIFIER is the DB Identifier
To get the DB Identifier use
SELECT datdba FROM pg_database WHERE datname = 'mydatabase'

Hope that helps ?

Best regards
Manfred Peter
Alligator Company Software GmbH
http://www.alligatorsql.com

No comments:

Post a Comment