select only default - Mailing list pgsql-novice

From Nabil Sayegh
Subject select only default
Date
Msg-id 1053041523.979.16.camel@billy
Whole thread Raw
Responses Re: select only default
List pgsql-novice
Hi all,

just for curiosity:

Is it possible to SELECT a row that consists only of default values of a
table ?

Let's suppose I have a Table:

CREATE TEMP TABLE tempo
(
 a int DEFAULT 5,
 b text DEFAULT 'five'
);

I want as a result:

(5, 'five')

But without inserting a row.

Is this possible with 1 query ?

I thought of something like OUTER JOINS where you get defaults for
non-existing rows, too.

What I need this for ?
I want to present users a form for inserting new rows. The form should
be loaded with default values.

Of course I can do it without SQL, but I thought, hey, that'd be cool in
plain SQL.

BTW: The DEFAULT values are all 'simple' types, no serials etc. included

TIA
--
 e-Trolley Sayegh & John, Nabil Sayegh
 Tel.: 0700 etrolley /// 0700 38765539
 Fax.: +49 69 8299381-8
 PGP : www.e-trolley.de


pgsql-novice by date:

Previous
From: "Fontenot, Paul"
Date:
Subject:
Next
From: Bruno Wolff III
Date:
Subject: Re: select only default