Re: [SQL] rewriting values with before trigger

From: Dennis Gearon <gearond(at)cvc(dot)net>
To: josh(at)agliodbs(dot)com
Cc: Robert Treat <xzilla(at)users(dot)sourceforge(dot)net>, elein(at)varlena(dot)com, elein <elein(at)sbcglobal(dot)net>, "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 17:47:35
Message-ID: 3EA974B7.4090309@cvc.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

It's a lot of work to write the functions, but it is the best way to keep the db intact.

Josh Berkus wrote:
> Robert,
>
>
>>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 ''
>
>
> Incidentally, this sort of problem is why most of my apps are based on "push"
> data functions. i.e., instead of the client calling:
> INSERT INTO foo VALUES ( id, bar1, bar2, bar3 );
> it calls
> SELECT df_modify_foo ( id, bar1, bar2, bar3 );
>
> Data-push functions allow me to do a whole array of validation and custom
> error message return that would be impractical with triggers. It also
> allows me to build security checks in to the back-end, via:
>
> SELECT df_modify_foo ( user_id, session_key, id, bar1, bar2, bar3 )
>
> ... allowing me to check all of the following things:
> Does the user have a valid session?
> Does the user have rights to foo?
> Does the user have a lock on foo?
> Is this a new foo record, or a modified one?
> etc.
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message scott.marlowe 2003-04-25 17:48:09 Re: Performance problems
Previous Message mallah 2003-04-25 17:39:03 Re: Postgres client/server parameters?

Browse pgsql-sql by date

  From Date Subject
Next Message Ian Barwick 2003-04-25 18:10:11 Re: sorting chinese characters
Previous Message Josh Berkus 2003-04-25 17:20:48 Re: [SQL] rewriting values with before trigger