Re: select only default

From: "Ville Jungman" <ville_jungman(at)hotmail(dot)com>
To: bruno(at)wolff(dot)to, postgresql(at)e-trolley(dot)de
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: select only default
Date: 2003-05-16 08:29:33
Message-ID: Law11-F78F1Kve5faG200026c41@hotmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)wolff(dot)to>
>To: Nabil Sayegh <postgresql(at)e-trolley(dot)de>
>CC: pgsql-novice <pgsql-novice(at)postgresql(dot)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(at)e-trolley(dot)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

Browse pgsql-novice by date

  From Date Subject
Next Message Crombleholme, Roy 2003-05-16 09:00:11 datestyle
Previous Message Bruno Wolff III 2003-05-16 02:30:59 Re: select only default