Skip site navigation (1) Skip section navigation (2)

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-23 01:37:56
Message-ID: 20050623013756.GA31220@winnie.fuhr.org (view raw or flat)
Thread:
Lists: pgsql-novice
On Wed, Jun 22, 2005 at 11:49:59PM +0000, Prasad dev wrote:
> 
> Basically i am dealing with triggers which addresses referential integrity, 

Are you familiar with foreign key constraints?  PostgreSQL can
automatically do referential integrity checks for you.

http://www.postgresql.org/docs/7.3/static/tutorial-fk.html
http://www.postgresql.org/docs/7.3/static/ddl-constraints.html#DDL-CONSTRAINTS-FK
http://www.postgresql.org/docs/7.3/static/sql-createtable.html

(Links are to the 7.3 documentation because you said you were running
that version.)

> SO in the end what i look for is a proper message instead of "DELETE 0".

You could do this in application code, or you could wrap the delete
in a function that checks how many rows were deleted and raises a
notice if the count was zero.

http://www.postgresql.org/docs/7.3/static/plpgsql-statements.html#PLPGSQL-STATEMENTS-DIAGNOSTICS

If you were using 7.4 or later, you could use a statement-level
AFTER trigger to raise a notice if no rows were deleted.  But it's
still not clear what value such a notice would add.

> by the way what do you mean by dont post in HTML ?

Your previous messages were HTML-formatted.  Some people use
text-based mail readers, so they have to take extra steps to convert
the HTML to something legible; also, some people's spam filters
might automatically delete HTML messages.  Plain text is more likely
to be acceptable to some people.

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

In response to

pgsql-novice by date

Next:From: Keith WorthingtonDate: 2005-06-23 02:55:07
Subject: Search function
Previous:From: Prasad devDate: 2005-06-22 23:49:59
Subject: Re: Raise Notice

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group