Re: Raise Notice - Mailing list pgsql-novice

From Michael Fuhr
Subject Re: Raise Notice
Date
Msg-id 20050620031521.GA20643@winnie.fuhr.org
Whole thread Raw
In response to Raise Notice  ("Prasad dev" <esteem3300@hotmail.com>)
List pgsql-novice
[Please don't post in HTML.]

On Mon, Jun 20, 2005 at 12:27:41AM +0000, Prasad dev wrote:

> I have been trying to figure out why this simple query doesn't
> execute if no record exist !
>
> CREATE OR REPLACE FUNCTION del_rest() RETURNS TRIGGER AS '
> DECLARE
>     t record;
>   BEGIN
>       SELECT * INTO t FROM del2 WHERE (d2=OLD.d2 or old.d2 is null)
> and (d3=OLD.d3 or  old.d2 is null);

In the last line above, should the last part of the expression be
"old.d3 is null" instead of "old.d2 is null"?  Perhaps that's why
the subsequent IF NOT FOUND isn't doing what you expect, if that's
indeed the problem you mean.

If the expression is correct as shown, then please post a minimal
but complete example that somebody could load into an empty database
to reproduce the problem.  That is, all SQL statements to create
the necessary tables, functions, and triggers, and to populate the
tables with a sample data set; also the query that's not behaving
the way you expect and an explanation of what you'd like it to do.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

pgsql-novice by date:

Previous
From: John DeSoi
Date:
Subject: Re: help with function .. .. date data type
Next
From: sara simoes
Date:
Subject: Data Migration from Access to Postgresql