Re: Dynamically discovering field names in PLPGSQL queries

Поиск
Список
Период
Сортировка
От Bruno Wolff III
Тема Re: Dynamically discovering field names in PLPGSQL queries
Дата
Msg-id 20010821072253.B4270@wolff.to
обсуждение исходный текст
Ответ на Dynamically discovering field names in PLPGSQL queries  ("Oberpriller, Wade D." <oberpwd@nsc-msg01.network.com>)
Список pgsql-general
On Mon, Aug 20, 2001 at 04:44:13PM -0500,
  "Oberpriller, Wade D." <oberpwd@nsc-msg01.network.com> wrote:
> Is there a way to discover the names of the fields in a record from a SELECT
> statement in PLPGSQL?
>
> For example:
>
> SELECT INTO REC * FROM mytable;
>
> Is there a mechanism to determine what the "*" expanded to? or does a
> programmer always have to know the layout of the table apriori?

I think the following will work:
select attname from pg_attribute, pg_class where attrelid = relfilenode and
attnum > 0 and relname = 'mytable' order by attnum;

I tried this on one of my tables and it looked OK.

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

Предыдущее
От: "Jim Buttafuoco"
Дата:
Сообщение: Re: clustering and/or failover?
Следующее
От: newsreader@mediaone.net
Дата:
Сообщение: Re: Re: is this possible? it should be!