Re: Porting from MySql - meta data issues - Mailing list pgsql-general

From Andreas Scherbaum
Subject Re: Porting from MySql - meta data issues
Date
Msg-id 3CADA942.487A0675@htl.de
Whole thread Raw
In response to Porting from MySql - meta data issues  (Geoff Caplan <geoff@advantae.com>)
List pgsql-general
Geoff Caplan wrote:

> I'm porting quite a big PHP application from MySql and have hit an issue.
>
> I have a number of PHP functions in the app which return meta-info about
> the data structure:

brave new SQL, once created for database independence... ;-)

> With MySql, this info is readily available using the various SHOW queries,
> but I can't figure out how to do this with Postgres.
>
> The only option I have come up with is to shell out to psql, run \l and \d
> commands, and use a regex to parse the strings returned. Clearly, this
> would be a bit of a hack, and not resource efficient.

start psql with the -E option (see the manpage). This will display all
queries,
which the psql tool does send to the backend.
You can fetch all kind of informations you need from the pg_* tables.


Best regards

--
                                  Andreas 'ads' Scherbaum

pgsql-general by date:

Previous
From: Geoff Caplan
Date:
Subject: Porting from MySql - meta data issues
Next
From: Heiko Klein
Date:
Subject: triggering a sequence