Re: column name with plpgsql - Mailing list pgsql-general

From Raymond O'Donnell
Subject Re: column name with plpgsql
Date
Msg-id 498D9B8B.5090003@iol.ie
Whole thread Raw
In response to column name with plpgsql  (Alain Roger <raf.news@gmail.com>)
Responses Re: column name with plpgsql  (Alain Roger <raf.news@gmail.com>)
List pgsql-general
On 07/02/2009 14:26, Alain Roger wrote:

> i have a table which can be altered with several additional column. How can
> i test under plpgsql if a particular column already exists ?

select 1 from information_schema.columns
  where table_name = 'your_table_name_here'
  and column_name = 'your_column_name_here';

HTH,

Ray.

------------------------------------------------------------------
Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
rod@iol.ie
Galway Cathedral Recitals: http://www.galwaycathedral.org/recitals
------------------------------------------------------------------

pgsql-general by date:

Previous
From: Grzegorz Jaśkiewicz
Date:
Subject: Re: column name with plpgsql
Next
From: Alain Roger
Date:
Subject: Re: column name with plpgsql