[SQL] Queyring for columns which are exist in table.

2011-01-27 Thread Santosh Bhujbal (sabhujba)
Hi All, I want to fire a query such that if the particular column does not exist then query should return some default value. For that I have tried following experiment. SETUP details: Platform : Sun Solaris 5.10 Postgres : 8.3.7 CREATE TABLE tbl ( c1 integer,

Re: [SQL] Queyring for columns which are exist in table.

2011-01-25 Thread msi77
Why would not use information schema to checking of existence of some column in a table: select column_name from information_schema.columns where table_name='tbl' -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpr

[SQL] Queyring for columns which are exist in table.

2011-01-25 Thread Santosh Bhujbal (sabhujba)
Hi All, I want to fire a query such that if the particular column does not exist then query should return some default value. For that I have tried following experiment. CREATE TABLE tbl ( c1 integer, c2 integer, c3 integer ); INSERT INTO tbl VALUES (1, 2, 3); INSERT I