Обсуждение: Where I can find PL/pgSQL and Trigger Examples?

Поиск
Список
Период
Сортировка

Where I can find PL/pgSQL and Trigger Examples?

От
Alessandro Bottoni
Дата:
I'm in the need (for the first time in my life) to intercept an UPDATE
operation (before it is executed) and use its parameters to perform an
equivalent INSERT operation on the same table (of course on a different row).
This small trigger is required to bybass a small bug in a third-party program
I'm using for my work.

I checked both "Postgres: introduction and concepts" and "Practical Postgres"
for examples (as well as the User's and Developer's guides of Postgres) but
I'm still confused by the PL/pgSQL sintax and by the "quotes puzzle". As a
consequence, I'm looking for real-world/working examples of Triggers and
PL/pgPSQL (in particular, examples that performs INSERT operation with
variables values).

Is there anything like a repository of PL/pgSQL examples on the Net? I mean:
something like the "cookbooks" published by ActiveState
(ASPN.activestate.com). Where I can find a (possibly _huge_) collection of
PL/pgSQL programs?

Many thanks for your attention.

---------------------
Alessandro Bottoni


Re: Where I can find PL/pgSQL and Trigger Examples?

От
Adam Witney
Дата:
There are a few examples here

http://www.brasileiro.net:8080/postgres/cookbook/



> I'm in the need (for the first time in my life) to intercept an UPDATE
> operation (before it is executed) and use its parameters to perform an
> equivalent INSERT operation on the same table (of course on a different row).
> This small trigger is required to bybass a small bug in a third-party program
> I'm using for my work.
>
> I checked both "Postgres: introduction and concepts" and "Practical Postgres"
> for examples (as well as the User's and Developer's guides of Postgres) but
> I'm still confused by the PL/pgSQL sintax and by the "quotes puzzle". As a
> consequence, I'm looking for real-world/working examples of Triggers and
> PL/pgPSQL (in particular, examples that performs INSERT operation with
> variables values).
>
> Is there anything like a repository of PL/pgSQL examples on the Net? I mean:
> something like the "cookbooks" published by ActiveState
> (ASPN.activestate.com). Where I can find a (possibly _huge_) collection of
> PL/pgSQL programs?
>
> Many thanks for your attention.
>
> ---------------------
> Alessandro Bottoni
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.