Re: Select default values

From: "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Select default values
Date: 2008-07-23 09:26:55
Message-ID: 20080723092655.GC28492@a-kretschmer.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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" ?
> Unfortunately this syntax doesn't seem to be supported. I know i can select
> the default values for each column, but being able to select them in one go
> would be handy...

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)

HTH, Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Pavel Stehule 2008-07-23 09:28:54 Re: Select default values
Previous Message Maximilian Tyrtania 2008-07-23 08:32:58 Select default values