Re: Converting empty input strings to Nulls

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: Ken Winter <ken(at)sunward(dot)org>
Cc: PostgreSQL pg-general List <pgsql-general(at)postgresql(dot)org>
Subject: Re: Converting empty input strings to Nulls
Date: 2008-05-31 18:54:25
Message-ID: 1212260065.6360.1.camel@jdavis
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, 2008-05-31 at 13:40 -0400, Ken Winter wrote:
> I'm looking for a way to trap this bad input at the database level, quietly
> convert the input empty strings to Null, and store the Null in the date
> column. I tried a BEFORE INSERT OR UPDATE trigger evoking this function ...

You can replace your table with a view and use rules to transform the
updates and inserts.

Regards,
Jeff Davis

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Sushant Sinha 2008-05-31 23:58:41 Re: [GENERAL] Fragments in tsearch2 headline
Previous Message Craig Ringer 2008-05-31 18:52:34 Re: Converting empty input strings to Nulls