Re: SELECT <all fields except "bad_field"> from mytbl;

From: Erwin Brandstetter <brsaweda(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: SELECT <all fields except "bad_field"> from mytbl;
Date: 2007-06-04 22:41:38
Message-ID: 1180996898.496026.217420@w5g2000hsg.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Or even, slightly shorter:

EXECUTE
'SELECT '
|| array_to_string(ARRAY(
SELECT a.attname
FROM pg_class c, pg_namespace n, pg_attribute a
WHERE n.oid = c.relnamespace
AND a.attrelid = c.oid
AND a.attnum >= 1
AND n.nspname = 'myschema'
AND c.relname = 'mytbl'
AND a.attname <> 'bad_field'
ORDER by a.attnum), ', ')
|| ' FROM myschema.mytbl';

/E

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Guy Rouillier 2007-06-04 22:54:55 Re: Encrypted column
Previous Message Erwin Brandstetter 2007-06-04 22:36:02 Re: SELECT <all fields except "bad_field"> from mytbl;