Re: Porting from MySql - meta data issues

Поиск
Список
Период
Сортировка
От Joe Conway
Тема Re: Porting from MySql - meta data issues
Дата
Msg-id 3CADBC69.8090307@joeconway.com
обсуждение исходный текст
Ответ на Porting from MySql - meta data issues  (Geoff Caplan <geoff@advantae.com>)
Список pgsql-general
Geoff Caplan wrote:
> Hi folks
>
> 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.
>
> 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.
>
> 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...
>

Start up psql with -E on the command line. That will show you the
internal queries being used by psql to generate the output.

Hope this helps,

Joe




В списке pgsql-general по дате отправления:

Предыдущее
От: mixo
Дата:
Сообщение: dates
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Dead devel-corner links