Can I get the default value for an attribute (field) ? - Mailing list pgsql-general

From Joel Burton
Subject Can I get the default value for an attribute (field) ?
Date
Msg-id Pine.LNX.4.21.0104011721250.6059-100000@olympus.scw.org
Whole thread Raw
Responses Re: Can I get the default value for an attribute (field) ?
Re: Can I get the default value for an attribute (field) ?
List pgsql-general
I'm building a GUI for a PostgreSQL database. In the DB, many fields have
default values (a few are complicated, like the results of a sequence, but
most are simple things like FALSE or 0 or such.)

Is there a way to get what the default value for a field would be when a
new record is added? For some tables, I could (behind the users back) add
a row, grab the values given in each column, delete the row, then
present these as 'default' values; however, in most tables, there are
columns that cannot be null and do not have default values, therefore I
can't just add a row using the default-only values.

I've been looking around for a miraculous SELECT
default_value(table.class) function, but can't seem to find it. Any ideas?

--
Joel Burton   <jburton@scw.org>
Director of Information Systems, Support Center of Washington


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: another index question
Next
From: "ADBAAMD"
Date:
Subject: Re: another index question