Re: Dumb question: How do I determine programmatically if a column is nullable? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Dumb question: How do I determine programmatically if a column is nullable?
Date
Msg-id 3816.1073540510@sss.pgh.pa.us
Whole thread Raw
In response to Re: Dumb question: How do I determine programmatically if a column is nullable?  ("Dann Corbit" <DCorbit@connx.com>)
List pgsql-hackers
"Dann Corbit" <DCorbit@connx.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


pgsql-hackers by date:

Previous
From: "Dann Corbit"
Date:
Subject: Re: Dumb question: How do I determine programmatically if a column is nullable?
Next
From: Stephen Frost
Date:
Subject: Segfault in 7.4.1 (and 7.3.4) during vacuum analyze