Re: [GENERAL] column names query

Поиск
Список
Период
Сортировка
От hamann.w@t-online.de
Тема Re: [GENERAL] column names query
Дата
Msg-id wolfgang-1170907152654.A0430521@noten19.local
обсуждение исходный текст
Ответ на Re: [GENERAL] column names query  (stimits@comcast.net)
Ответы Re: [GENERAL] column names query  (Manuel Gómez <targen@gmail.com>)
Список pgsql-general
>> SELECT table_name, column_name
>> FROM information_schema.columns
>> WHERE table_name = 'your_name';
>>
>> ----- Original Message -----From: hamann w <hamann.w@t-online.de>To: pgsql-general@postgresql.orgSent: Thu, 07 Sep
201707:18:12 -0000 (UTC)Subject: [GENERAL] column names query 
>>
>>
>>
>> Hi,
>>
>> is there a simple way to retrieve column names from a query - basically the way psql addscolumn headings when I do a
select?
>>
>> Best regardsWolfgang Hamann
>>
>>
>>
>> -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org)To make changes to your
subscription:http://www.postgresql.org/mailpref/pgsql-general
>>

Hi,

I am already using something like this (but using pg_attribute table) to retrieve current table layout
for static tables. At the moment I am looking for a solution for ad hoc queries

Example query
select a.col1, case when a.col2 > 0 then a.col3 else b.xcol1 end as mycol3 from a left join b on ....
Expected response
col1 mycol3

Obviously, I could save the result into a temp table and retrieve the table's heading.

Best regards
Wolfgang Hamann





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

Предыдущее
От: hamann.w@t-online.de
Дата:
Сообщение: Re: [GENERAL] column names query
Следующее
От: Manuel Gómez
Дата:
Сообщение: Re: [GENERAL] column names query