Re: select only default - Mailing list pgsql-novice

From Ville Jungman
Subject Re: select only default
Date
Msg-id Law11-F78F1Kve5faG200026c41@hotmail.com
Whole thread Raw
In response to select only default  (Nabil Sayegh <postgresql@e-trolley.de>)
List pgsql-novice
default values are id pg_attrdef table. you should join pg_class-table with
it because it contains column names.

this query should solve (at least a part of) your problem:

select a.adsrc from pg_attrdef a,pg_class c where a.adrelid=c.relfilenode
and c.relname='tablename';

, where 'tablename' is the name of your table.

ville jungman, ulvilantie 3 b 11, 00350 helsinki, finland
tel. + 358 - 9 - 225 4482 , http://www.kolumbus.fi/vilmak
usko Herraan Jeesukseen, niin sin� pelastut. (apt. 16:31)




>From: Bruno Wolff III <bruno@wolff.to>
>To: Nabil Sayegh <postgresql@e-trolley.de>
>CC: pgsql-novice <pgsql-novice@postgresql.org>
>Subject: Re: [NOVICE] select only default
>Date: Thu, 15 May 2003 21:30:59 -0500
>
>On Fri, May 16, 2003 at 01:32:03 +0200,
>   Nabil Sayegh <postgresql@e-trolley.de> wrote:
> > Hi all,
> >
> > just for curiosity:
> >
> > Is it possible to SELECT a row that consists only of default values of a
> > table ?
>
>There is probably some way to get the data out of the system tables. If
>the defaults are constants you might be able to easily present it.
>
>However, for what you are doing it may be better to put the defaults
>in a separate table and get them from there. You will have to create
>a function(s) for getting the default values since you can't use
>select in a default clause.
>
>---------------------------(end of broadcast)---------------------------
>TIP 4: Don't 'kill -9' the postmaster

_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail


pgsql-novice by date:

Previous
From: Bruno Wolff III
Date:
Subject: Re: select only default
Next
From: "Crombleholme, Roy"
Date:
Subject: datestyle