Re: Select default values

Поиск
Список
Период
Сортировка
От Scott Marlowe
Тема Re: Select default values
Дата
Msg-id dcc563d10807230729r1aa17fbdja849a6fea465bf4a@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Select default values  (Maximilian Tyrtania <maximilian.tyrtania@onlinehome.de>)
Список pgsql-sql
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.


В списке pgsql-sql по дате отправления:

Предыдущее
От: Maximilian Tyrtania
Дата:
Сообщение: Re: Select default values
Следующее
От: Emi Lu
Дата:
Сообщение: Query prepared plan