Re: Raise Notice

Поиск
Список
Период
Сортировка
От Michael Fuhr
Тема Re: Raise Notice
Дата
Msg-id 20050623013756.GA31220@winnie.fuhr.org
обсуждение исходный текст
Ответ на Re: Raise Notice  ("Prasad dev" <esteem3300@hotmail.com>)
Список 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/

В списке pgsql-novice по дате отправления:

Предыдущее
От: "Prasad dev"
Дата:
Сообщение: Re: Raise Notice
Следующее
От: Keith Worthington
Дата:
Сообщение: Search function