Re: existence of column name

From: John R Pierce <pierce(at)hogranch(dot)com>
To: Eric Smith <eric_h_smith(at)mac(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: existence of column name
Date: 2009-04-09 03:54:33
Message-ID: 49DD7179.9030100@hogranch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Eric Smith wrote:
> All,
>
> From the C API, how do I check for the existence of a column name in a
> given table?

select data_type from information_schema.columns where
table_schema='public' and table_name='given_table' and
column_name='some_column';

that will return the data_type if the column exists, or return zero rows
if it doesn't.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Craig Ringer 2009-04-09 04:53:51 Re: database corruption
Previous Message Eric Smith 2009-04-09 03:29:26 existence of column name