Re: column name with plpgsql

From: Alain Roger <raf(dot)news(at)gmail(dot)com>
To: rod(at)iol(dot)ie
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: column name with plpgsql
Date: 2009-02-07 14:35:14
Message-ID: 75645bbb0902070635v94e4857m9bedc251640ec041@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thanks a lot Raymond it works well.

On Sat, Feb 7, 2009 at 3:32 PM, Raymond O'Donnell <rod(at)iol(dot)ie> wrote:

> 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(at)iol(dot)ie
> Galway Cathedral Recitals: http://www.galwaycathedral.org/recitals
> ------------------------------------------------------------------
>

--
Alain
-----------------------------------------------------------
Windows XP x64 SP2 / Fedora 10 KDE 4.2
PostgreSQL 8.3.5 / MS SQL server 2005
Apache 2.2.10
PHP 5.2.6
C# 2005-2008

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2009-02-07 15:01:41 Re: how to find foreign key details (column, that is)
Previous Message Raymond O'Donnell 2009-02-07 14:32:43 Re: column name with plpgsql