Re: function on trigger

From: Sim Zacks <sim(at)compulab(dot)co(dot)il>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: function on trigger
Date: 2011-09-01 04:46:19
Message-ID: 4E5F0E1B.3050707@compulab.co.il
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html style="direction: ltr;">
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<style>body p { margin-bottom: 0cm; margin-top: 0pt; } </style>
</head>
<body style="direction: ltr;"
bidimailui-detected-decoding-type="latin-charset" bgcolor="#ffffff"
text="#000000">
On 09/01/2011 01:39 AM, Marcos Hercules Santos wrote:
<blockquote
cite="mid:b3ba2b32-278f-4216-9de3-39ab2162fc23(at)y21g2000yqy(dot)googlegroups(dot)com"
type="cite">
<pre wrap="">hi guys

I'm newbie in Psql and I'm trying to build one function in order to
count the products for each supplier. So i'm gonna put it quite simply
though this example

Please, consider a table called books with the following fields

bookid, title, price, idPublisher

and one another table called publisher

Idpublisher, name, city, Books

Being in that last field from Publisher, called book, I gotta have the
amount of published books for each publisher.

</pre>
</blockquote>
One way to do this would be with a view, so you don't need the
trigger. The other one would need to be after update, insert and
delete. This would include code such as:<br>
update publisher set books=books[+|-]1 where
idpublisher=[new|old].idpublisher;<br>
<br>
Sim<br>
</body>
</html>

Attachment Content-Type Size
unknown_filename text/html 1.4 KB

In response to

Browse pgsql-general by date

  From Date Subject
Next Message John R Pierce 2011-09-01 04:48:26 Re: function on trigger
Previous Message David Johnston 2011-09-01 04:20:25 Re: function on trigger