pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Josh Berkus <josh@agliodbs.com>
To: Robert Treat <xzilla@users.sourceforge.net>
To: elein@varlena.com, elein <elein@sbcglobal.net>
Cc: pgsql-general@postgresql.org <pgsql-general@postgresql.org>
Cc: pgsql-sql@postgresql.org
Subject: Re: [SQL] rewriting values with before trigger
Date: Fri, 25 Apr 2003 10:20:48 -0700
Message-ID: <200304251020.48678.josh@agliodbs.com> (raw)
In-Reply-To: <200304250003.24506.xzilla@users.sourceforge.net>
References: <1051201544.4753.522.camel@camel>
	<200304250033.h3P0XuDl088102@pimout1-ext.prodigy.net>
	<200304250003.24506.xzilla@users.sourceforge.net>

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.

-- 
-Josh Berkus
 Aglio Database Solutions
 San Francisco




view thread (18+ messages)  latest in thread

Message-ID: <200304251020.48678.josh@agliodbs.com>
Permalink:  ../200304251020.48678.josh@agliodbs.com/
Also on:    postgresql.org/message-id/200304251020.48678.josh@agliodbs.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: josh@agliodbs.com, xzilla@users.sourceforge.net, elein@sbcglobal.net, pgsql-general@postgresql.org
  Subject: Re: [SQL] rewriting values with before trigger
  In-Reply-To: <200304251020.48678.josh@agliodbs.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox