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

2011-01-27 Thread Sim Zacks
ment? Thanks, Santosh. *From:*pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] *On Behalf Of *Sim Zacks *Sent:* Thursday, January 27, 2011 4:26 PM *To:* pgsql-general@postgresql.org *Subject:* Re: [GENERAL] Queyring for columns which are exist in table. On 01/

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

2011-01-27 Thread Sim Zacks
On 01/27/2011 09:52 AM, Santosh Bhujbal (sabhujba) wrote: CREATE OR REPLACE FUNCTION ColumnAlreadyExists(name, name) RETURNS INTEGER AS E' DECLARE columnCount INTEGER; BEGIN SELECT COUNT (pg_attribute.attname) into columnCount FROM pg_attribute,pg_class, pg_type WHERE ((pg_attribute.attrel

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

2011-01-27 Thread Thom Brown
On 27 January 2011 09:53, Santosh Bhujbal (sabhujba) wrote: > Hi Thom, > > Thank you for your response. > > I have a application which is periodically gathering diff stats from > diff devices and put them into database. > Tables are created per stat, per device and per day. > e.g. stat1_dev1_20100

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

2011-01-27 Thread Santosh Bhujbal (sabhujba)
lumns which are exist in table. On 27 January 2011 07:52, Santosh Bhujbal (sabhujba) wrote: > Hi All, > > > > I want to fire a query such that if the particular column does not exist > then query should return some default value. Why do you want to do this? What is it you using th

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

2011-01-27 Thread Thom Brown
On 27 January 2011 07:52, Santosh Bhujbal (sabhujba) wrote: > Hi All, > > > > I want to fire a query such that if the particular column does not exist > then query should return some default value. Why do you want to do this? What is it you using this for? -- Thom Brown Twitter: @darkixion IRC

[GENERAL] 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,

[GENERAL] 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