Re: function on trigger

Поиск
Список
Период
Сортировка
От David Johnston
Тема Re: function on trigger
Дата
Msg-id 23226B29-9B3A-4778-B7C2-7C990897B712@yahoo.com
обсуждение исходный текст
Ответ на function on trigger  (Marcos Hercules Santos <mhercs@gmail.com>)
Список pgsql-general
On Aug 31, 2011, at 18:39, Marcos Hercules Santos <mhercs@gmail.com> wrote:

> 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.

Is there a question somewhere?


>
Do not be tempted by the dark side Marcos.  Create a view that uses a join and a count.  Only if you have significant
performanceissues would you then consider materializing that view. 

If you insist, or simply want to learn, read the sections on UPDATE, CREATE TRIGGER, and CREATE FUNCTION.  Try doing it
followingthose examples.  Ask more specific questions if something specific stumps you. 

Do it incrementally.  Get the raw SQL UPDATE working then create the trigger and function and get those working.  Then
combinethe two. 

David J.


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

Предыдущее
От: Marcos Hercules Santos
Дата:
Сообщение: function on trigger
Следующее
От: John R Pierce
Дата:
Сообщение: Re: function on trigger