Re: SQL QUERY - Mailing list pgsql-sql

From Achilleus Mantzios
Subject Re: SQL QUERY
Date
Msg-id Pine.LNX.4.44.0212031503390.6454-100000@matrix.gatewaynet.com
Whole thread Raw
In response to SQL QUERY  ("Pedro Igor" <pedroigor@aip.com.br>)
List pgsql-sql
On Tue, 3 Dec 2002, Pedro Igor wrote:

> I have the following function:
> CREATE FUNCTION public.auto_incremento() RETURNS trigger AS '
> begin
> new.id = (select (max(id) + 1) from teste);
> return new;
> end;' LANGUAGE 'plpgsql'
>
> I created a trigger that uses this function, but i want to the function be usefull for all tables and not only to
tbaleteste.
 
>
> Someone know how ???

Take a look at sequences.
(In Addition, they are autimatically created when a column is of type
'SERIAL').

>
>
>
> Pedro Igor
>
>
>
>

==================================================================
Achilleus Mantzios
S/W Engineer
IT dept
Dynacom Tankers Mngmt
Nikis 4, Glyfada
Athens 16610
Greece
tel:    +30-10-8981112
fax:    +30-10-8981877
email:  achill@matrix.gatewaynet.com       mantzios@softlab.ece.ntua.gr



pgsql-sql by date:

Previous
From: "Pedro Igor"
Date:
Subject: SQL QUERY
Next
From: "Ries van Twisk"
Date:
Subject: [OT] Inventory systems (private)