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)
at it take care of newly added columns. Thanks, Santosh. -Original Message- From: Thom Brown [mailto:t...@linux.com] Sent: Thursday, January 27, 2011 3:09 PM To: Santosh Bhujbal (sabhujba) Cc: pgsql-...@postgresql.org; pgsql-general@postgresql.org Subject: Re: [GENERAL] Queyring for co

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