Porting from MySql - meta data issues

From: Geoff Caplan <geoff(at)advantae(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Porting from MySql - meta data issues
Date: 2002-04-05 07:48:03
Message-ID: 5.1.0.14.0.20020405084204.036b0840@pop.dsl.pipex.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi folks

[Repost of a message that didn't seem to make it onto the list...]

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:

list_databases( ) ;
list_tables( $database_name ) ;
list_field_names( $table_name ) ;
is_existing_field( $table_name ) ;

With MySql, this info is readily available using the various SHOW queries,
but I can't figure out how to do this with Postgres.

For databases and tables, the only option I have come up with is to shell
out to psql and use a regex to parse the strings returned. Clearly, this
would be a bit of a hack, and not resource efficient. For field names, I
guess I could do a SELECT, provided there is at least one record, and get
at the field names returned... Again, not very elegant.

Can any kind person suggest a more effective approach? I am brand new to
Postgres, and doing this under considerable time pressure, so apologies if
I am missing anything obvious - I can't find anything in the docs, or in
the articles on porting from MySQL...

Geoff Caplan
Advantae Ltd

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Masse Jacques 2002-04-05 09:10:53 text and numeric
Previous Message Holger Marzen 2002-04-05 07:25:53 Re: Update to readline and Postgresql