How to query by column names

From: Richard Ray <rray(at)mstc(dot)state(dot)ms(dot)us>
To: pgsql-sql(at)postgresql(dot)org
Subject: How to query by column names
Date: 2007-01-22 22:25:08
Message-ID: Pine.LNX.4.64.0701221612220.10491@rray.drdc.mstc.ms.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

This may be a simple but can I create a query such as

select (select attname from pg_attribute where attrelid = (select
relfilenode from pg_class where relname = 't1') and attisdropped =
false and attnum > 0) from t1;

I get
ERROR: more than one row returned by a subquery used as an expression

Thanks
Richard

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Jeff Frost 2007-01-22 23:29:36 Re: How to query by column names
Previous Message Aaron Bono 2007-01-22 19:54:16 Re: Schema sample