Re: Raise Notice

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Prasad dev <esteem3300(at)hotmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Raise Notice
Date: 2005-06-20 03:15:21
Message-ID: 20050620031521.GA20643@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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/

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message ed 2005-06-20 03:39:39 help with function .. .. date data type
Previous Message John DeSoi 2005-06-20 01:28:44 Re: help with function .. .. date data type