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

Re: [SQL] add column if doesn't exist (fwd)

From: "Jim C(dot) Nasby" <jnasby(at)pervasive(dot)com>
To: Qingqing Zhou <zhouqq(at)cs(dot)toronto(dot)edu>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: [SQL] add column if doesn't exist (fwd)
Date: 2005-09-29 20:50:38
Message-ID: 20050929205038.GN30974@pervasive.com (view raw or flat)
Thread:
Lists: pgsql-general
On Mon, Sep 26, 2005 at 07:16:53PM -0700, Qingqing Zhou wrote:
> 
> ""Brandon Metcalf"" <bmetcalf(at)nortel(dot)com> wrote
> >
> > Is there a way to check for the existence of a column in a table other
> > than, say, doing a SELECT on that column name and checking the output?
> >
> 
> Take a look at pg_attribute system table. 
> http://www.postgresql.org/docs/8.0/static/catalog-pg-attribute.html

You might find the information_schema or pg_newsysviews
(http://pgfoundry.org/projects/newsysviews/) easier to use.
-- 
Jim C. Nasby, Sr. Engineering Consultant      jnasby(at)pervasive(dot)com
Pervasive Software      http://pervasive.com    work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf       cell: 512-569-9461

In response to

pgsql-general by date

Next:From: Jim C. NasbyDate: 2005-09-29 20:54:52
Subject: Re: insertion becoming slow
Previous:From: Jim C. NasbyDate: 2005-09-29 20:49:00
Subject: Re: Performance woes relating to DISTINCT (I think)

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