Re: Using Insert - Default in a condition expression ??

From: Postgres User <postgres(dot)developer(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Using Insert - Default in a condition expression ??
Date: 2009-09-29 06:53:37
Message-ID: b88c3460909282353y65264361o78b1cd160b4035d3@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>> I'm trying to write an INSERT INTO statement that will use a DEFAULT
>> value when an input parameter is null.
>>
> Neither of my 2 methods are pretty.
> 1) Use a trigger.
> 2) Grab and cast the default value from the information_schema.columns
> view and plug it in.
>
> Another option is to build your insert sql as a string and then execute it.
>
> Sim
>

Thanks... those approaches came to mind. But I need something more
flexible as the Insert functions are generated by an ORM layer. It
has to be simpler.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message A. Kretschmer 2009-09-29 06:54:22 Re: Using Insert - Default in a condition expression ??
Previous Message Sim Zacks 2009-09-29 06:44:24 Re: Using Insert - Default in a condition expression ??