Re: field defaults

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Peter Childs <blue(dot)dragon(at)blueyonder(dot)co(dot)uk>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: field defaults
Date: 2003-03-28 13:57:00
Message-ID: Pine.LNX.4.44.0303281449000.2204-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)gmx(dot)net

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Liang Luo 2003-03-28 15:57:17 Re: How to show timestamp with milliseconds(3 digits) in Select clause in Ver7.1 ?
Previous Message Peter Eisentraut 2003-03-28 13:56:07 Re: How to configure two netcard for PostgreSQL?