Re: [SQL] rewriting values with before trigger

From: elein <elein(at)sbcglobal(dot)net>
To: Robert Treat <xzilla(at)users(dot)sourceforge(dot)net>, elein(at)varlena(dot)com
Cc: Josh Berkus <josh(at)agliodbs(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>, pgsql-sql(at)postgresql(dot)org
Subject: Re: [SQL] rewriting values with before trigger
Date: 2003-04-25 18:57:02
Message-ID: 200304251902.h3PJ2X0Y108326@pimout2-ext.prodigy.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql


OK. I understand what you mean. I was really focussing
on the engine handling rather than the application behaviour.

elein

On Thursday 24 April 2003 21:03, Robert Treat wrote:
> On Thursday 24 April 2003 08:28 pm, elein wrote:
> > I don't think this is a bug at all.
> > Argument creation has to come before the execution
> > of the function. That in this case the argument is a row type
> > doesn't matter. It has nothing to do with the content of the
> > function and everything to do with creating the row NEW.
> > How can you possibly assign a value to NEW.bar if NEW as
> > a whole does not exist?
>
> You misunderstood. I don't think it's a bug in postgresql, it's a bug in
> the application that is hitting against my database. When it doesn't have a
> value for the timestamp field, it either needs to drop it from the insert
> statment or convert it to null; not send a ''
>
> > What are you really trying to do here? Maybe setting the
> > table column's default to NULL will achieve what you want.
>
> I have an application that is inserting information into a table
> periodically. Sometimes it passes in timestamps for certain fields, but
> sometimes it doesn't have any timestamp information. When it doesn't have
> information, it should send NULL. Unfortunatly the app writers wrote it to
> send ''. Default's don't work because the app is trying to post data, it's
> just not a valid datatype. Luckily in this instance I can tell the app
> guys they have to fix thier app instead of having to muck up the database.
>
> Robert Treat

--
----------------------------------------------------------------------------------------
elein(at)varlena(dot)com Database Consulting www.varlena.com
I have always depended on the [QA] of strangers.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David Link 2003-04-25 19:45:23 pq_recvbuf: unexpected EOF
Previous Message Vernon 2003-04-25 18:44:40 Re: Fwd: Unicode, RedHat Linux, & PostgreSQL

Browse pgsql-sql by date

  From Date Subject
Next Message Forest Wilkinson 2003-04-26 00:48:11 create/alter/drop within transactions?
Previous Message Vernon 2003-04-25 18:44:40 Re: Fwd: Unicode, RedHat Linux, & PostgreSQL