Re: Select default values - Mailing list pgsql-sql

From A. Kretschmer
Subject Re: Select default values
Date
Msg-id 20080723092655.GC28492@a-kretschmer.de
Whole thread Raw
In response to Select default values  (Maximilian Tyrtania <maximilian.tyrtania@onlinehome.de>)
Responses Re: Select default values
List 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


pgsql-sql by date:

Previous
From: Maximilian Tyrtania
Date:
Subject: Select default values
Next
From: "Pavel Stehule"
Date:
Subject: Re: Select default values