Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-sql by date

Next:From: Pavel StehuleDate: 2008-07-23 09:28:54
Subject: Re: Select default values
Previous:From: Maximilian TyrtaniaDate: 2008-07-23 08:32:58
Subject: Select default values

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group