Re: Dumb question: How do I determine programmatically if a column is nullable?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Dann Corbit" <DCorbit(at)connx(dot)com>
Cc: "Andreas Pflug" <pgadmin(at)pse-consulting(dot)de>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Dumb question: How do I determine programmatically if a column is nullable?
Date: 2004-01-08 05:41:50
Message-ID: 3816.1073540510@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Dann Corbit" <DCorbit(at)connx(dot)com> writes:
> In other words, I will be passed a SQL query. I don't want to have to
> parse it myself.
> Rather, I want to know (for the bound columns) if a column is nullable
> or not.
> Is the functionality available in [for example] libpq?

As of 7.4, see PQftable() and PQftablecol(), and look into pg_attribute
to see whether the column is marked NOTNULL.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2004-01-08 13:18:15 Segfault in 7.4.1 (and 7.3.4) during vacuum analyze
Previous Message Dann Corbit 2004-01-08 02:18:39 Re: Dumb question: How do I determine programmatically if a column is nullable?