On Wed, Jul 23, 2008 at 3:57 AM, Maximilian Tyrtania
<maximilian.tyrtania@onlinehome.de> wrote:
> Hi,
>
>> am Wed, dem 23.07.2008, um 10:32:58 +0200 mailte Maximilian Tyrtania
>> folgendes:
>>> Hi there, just a quickie: Is there a way to select all default values of a
>>> given table? Something like "Select Default values from sometable" ?
>>
>> test=# create table t_with_defaults( s1 int default 1, s2 int default 2);
>> CREATE TABLE
>> test=*# select ordinal_position, column_name, column_default from
>> information_schema.columns where table_name='t_with_defaults' order by 1;
>> ordinal_position | column_name | column_default
>> ------------------+-------------+----------------
>> 1 | s1 | 1
>> 2 | s2 | 2
>> (2 rows)
>
> This is probably what I should do, the only problem is that the output of
> the given query looks a lot less nice when the default looks like this
>
> nextval('mitarbeiter_serial'::regclass)
>
> I'd prefer to just receive the actual value of that function. Okay, I could
> just execute that statement, but, hmm, still, that seems akward.
Until you run that function, you don't know what the output might be
because of possible race condtitions.