Re: [SQL] rewriting values with before trigger

From: Dennis Gearon <gearond(at)cvc(dot)net>
To: Robert Treat <xzilla(at)users(dot)sourceforge(dot)net>
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-24 19:10:39
Message-ID: 3EA836AF.8060704@cvc.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

How about putting the data validity and conversion routine in ONE trigger?

OR, deliberately name your triggers with alphanumerical prefixes that forces them to fire in a certain order, and making the trigger that does the conversion fire first?

I have no idea how the transport of a value of '' happens in the parser if it's expecing a NULL/INT value, if it would even make it to the trigger stage <shrug>.

Robert Treat wrote:
> On Thu, 2003-04-24 at 12:39, Josh Berkus wrote:
>
>>Robert,
>>
>>
>>>Is there anyway to do be able to change the '' into NULL before data
>>>validity is checked with a trigger?
>>
>>What about using a RULE instead?
>>
>
>
> RULE's follow this same behavior, erroring out if the data is not a
> valid timestamp. (At least I've not been able to write a rule that
> doesn't follow this) In fact you actually can't create the rule if you
> have a where clause that isn't a proper matching datatype.
>
> I seem to recall a solution for folks who need '' to represent 0 in int
> fields was to use triggers or rules, but I guess that really isn't
> possible :-(
>
> Robert Treat
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faqs/FAQ.html
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message ahoward 2003-04-24 19:17:44 has_table_priviledge
Previous Message Jeff Eckermann 2003-04-24 19:07:54 Re: ODBC & Access [Try 2]

Browse pgsql-sql by date

  From Date Subject
Next Message Jamie Lawrence 2003-04-24 19:11:09 Rule definition problem
Previous Message Jamie Lawrence 2003-04-24 19:05:13 Rule definition problem