Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id A76941337BDD; Thu, 27 Jan 2011 05:53:26 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 06016-06-2; Thu, 27 Jan 2011 09:53:20 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from ams-iport-1.cisco.com (ams-iport-1.cisco.com [144.254.224.140]) by mail.postgresql.org (Postfix) with ESMTP id 1AC021337BD9; Thu, 27 Jan 2011 05:53:17 -0400 (AST) Authentication-Results: ams-iport-1.cisco.com; dkim=neutral (message not signed) header.i=none X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AuEEAMLPQE2Q/khLgWdsb2JhbACWH45bFgEWIiSfZ5s5hU8EhRWKXA Received: from ams-core-2.cisco.com ([144.254.72.75]) by ams-iport-1.cisco.com with ESMTP; 27 Jan 2011 09:53:16 +0000 Received: from xbh-bgl-412.cisco.com (xbh-bgl-412.cisco.com [72.163.129.202]) by ams-core-2.cisco.com (8.14.3/8.14.3) with ESMTP id p0R9r62Q019402; Thu, 27 Jan 2011 09:53:16 GMT Received: from xmb-bgl-416.cisco.com ([72.163.129.212]) by xbh-bgl-412.cisco.com with Microsoft SMTPSVC(6.0.3790.4675); Thu, 27 Jan 2011 15:23:15 +0530 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Re: Queyring for columns which are exist in table. Date: Thu, 27 Jan 2011 15:23:14 +0530 Message-ID: In-Reply-To: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [GENERAL] Queyring for columns which are exist in table. Thread-Index: Acu+BjEaFeGvMymWRh6U0Eji+NEHawAAA8mg References: From: "Santosh Bhujbal (sabhujba)" To: "Thom Brown" Cc: , X-OriginalArrivalTime: 27 Jan 2011 09:53:15.0566 (UTC) FILETIME=[048E94E0:01CBBE08] X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 201101/772 X-Sequence-Number: 172131 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_20100125, stat1_dev1_20100126, stat1_dev1_20100127, etc. stat1_dev2_20100125, stat1_dev2_20100126, stat1_dev2_20100127, etc. stat2_dev1_20100125, stat2_dev1_20100126, stat2_dev1_20100127, etc. stat2_dev2_20100125, stat2_dev2_20100126, stat2_dev2_20100127, etc. Now when I am upgrading my application with new version then there are some tables which are having some additional columns. In this case I have to alter each and every old tables in database with new column and it's default value. As there are large number of tables, the upgrade process is taking too much time (in days). To avoid above upgrade process I want to write a SQL statements such that it take care of newly added columns. Thanks, Santosh. -----Original Message----- From: Thom Brown [mailto:thom@linux.com]=20 Sent: Thursday, January 27, 2011 3:09 PM To: Santosh Bhujbal (sabhujba) Cc: pgsql-sql@postgresql.org; pgsql-general@postgresql.org Subject: Re: [GENERAL] Queyring for columns 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 this for? --=20 Thom Brown Twitter: @darkixion IRC (freenode): dark_ixion Registered Linux user: #516935