Skip site navigation (1) Skip section navigation (2)

Re: Queyring for columns which are exist in table.

From: Thom Brown <thom(at)linux(dot)com>
To: "Santosh Bhujbal (sabhujba)" <sabhujba(at)cisco(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org, pgsql-general(at)postgresql(dot)org
Subject: Re: Queyring for columns which are exist in table.
Date: 2011-01-27 10:08:31
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-generalpgsql-sql
On 27 January 2011 09:53, Santosh Bhujbal (sabhujba) <sabhujba(at)cisco(dot)com> 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_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.

You want to refer to a column which doesn't exist, but PostgreSQL
expects you to know what is available beforehand.  Is there any logic
to which tables have the additional column and which ones don't?  For
example, do all tables with the additional column have a name
containing a date after a certain point in time?

Thom Brown
Twitter: @darkixion
IRC (freenode): dark_ixion
Registered Linux user: #516935

In response to

pgsql-sql by date

Next:From: Jasen BettsDate: 2011-01-27 10:20:06
Subject: Re: Compare the resulta of a count sql into bash
Previous:From: Santosh Bhujbal (sabhujba)Date: 2011-01-27 09:53:14
Subject: Re: Queyring for columns which are exist in table.

pgsql-general by date

Next:From: Sim ZacksDate: 2011-01-27 10:56:01
Subject: Re: Queyring for columns which are exist in table.
Previous:From: Mark Morgan LloydDate: 2011-01-27 10:03:57
Subject: Re: Getting the name of the timezone, adjusted for daylight saving

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group