Re: Select default values

From: Maximilian Tyrtania <maximilian(dot)tyrtania(at)onlinehome(dot)de>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Select default values
Date: 2008-07-23 10:35:08
Message-ID: C4ACD5FC.302D0%maximilian.tyrtania@onlinehome.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi,

> begin
> insert ...
> rollback;
>
> it's not best solution, but it just works.

Ah, yes, of course, haven't thought of that.

Okay, here is one final (i hope) obstacle. My db has >200 tables and I'd
love to be able to write some function that would just take a tablename and
return the default values for a new record of that table. If "Select default
values from sometable" was supported than that would be a piece of cake (I'd
just do: Execute "Select default values from '||sometable||' into
somerecord" in a plpgsql function).

With your way (insert into f(a,b) values(default, default) returning *) i
need to know everything about the given table.

Hmm. Any ideas?

Best,

Maximilian Tyrtania

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Karsten Hilbert 2008-07-23 10:44:03 Re: Select default values
Previous Message Pavel Stehule 2008-07-23 10:19:48 Re: Select default values