[DB-SIG] postgres access to db structure

Federico Di Gregorio fog@mixadlive.com
25 May 2001 13:07:58 +0200


from a psql prompt (connected to any db) just type:

    \dS

to print the full list of system tables. they are always available, so
you just need to connect your application to the 'template1' database
and the start quering the system tables.
 
On 25 May 2001 12:39:00 +0200, pierre@saiph.com wrote:
> Hello everybody, Im new to this list
> My configuration: linux SuSE 7.0, postgres, python 1.5.2, psycopg
> I have a little app to develop, but if this works fine, the use of db
> might spread in our apps (as an alternative to bsddb and/or
> marshalling)
> Trying to keep all information in one place, as I have been taught, I
> try not to hardcode field names in the python code. One simple
> question: how can I query a database, to know which fields it has? the
> description attribute of a cursor seems ok to me, but its valid only
> when a query has been run, there must be a better way.
> I think I remember at least some DB (db2?) have system tables, holding
> this kind of information; is this normalized? how-to in postgres?
> I didnt find this in postgres doc.
> Sorry, its hardly a question for this list, more pure database...
> 
> -- 
> Pierre Imbaud <pierre@saiph.com>
> 12 Rue des Bosquets 91480 Quincy Sous Sénart France
> Tel:  01 69 00 94 57 Fax 09 47
> 
> 
> _______________________________________________
> DB-SIG maillist  -  DB-SIG@python.org
> http://mail.python.org/mailman/listinfo/db-sig

-- 
Federico Di Gregorio
MIXAD LIVE Chief of Research & Technology              fog@mixadlive.com
Debian GNU/Linux Developer & Italian Press Contact        fog@debian.org
                           Don't dream it. Be it. -- Dr. Frank'n'further