Re: field defaults - Mailing list pgsql-sql

From Peter Eisentraut
Subject Re: field defaults
Date
Msg-id Pine.LNX.4.44.0303281449000.2204-100000@peter.localdomain
Whole thread Raw
In response to field defaults  (Peter Childs <blue.dragon@blueyonder.co.uk>)
List pgsql-sql
Peter Childs writes:

>     I need a method of getting the column defaults out of my database.
> I would like to use them to fill in a screen so the user can then edit
> them before they insert the record.
>     Looking at how psql does this it does not seam very easy.
>     I think a view of the relevent system table should help.

Well, the default expressions are stored in the system table pg_attrdef,
but note that they are expressions.  Even if you could evaluate those
expressions yourself the results won't be the same as letting the database
evaluate them, because the data that the default expressions refer to
might have changed between the time you've read them and the time you're
inserting the data.

If you insist on this user interface you described, maybe it's better to
save your defaults somewhere else.

-- 
Peter Eisentraut   peter_e@gmx.net



pgsql-sql by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: How to configure two netcard for PostgreSQL?
Next
From: "Liang Luo"
Date:
Subject: Re: How to show timestamp with milliseconds(3 digits) in Select clause in Ver7.1 ?