pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Achilleus Mantzios <achill@matrix.gatewaynet.com>
To: Pedro Igor <pedroigor@aip.com.br>
Cc: pgsql-sql@postgresql.org
Subject: Re: SQL QUERY
Date: Tue, 3 Dec 2002 15:05:23 +0200 (EET)
Message-ID: <Pine.LNX.4.44.0212031503390.6454-100000@matrix.gatewaynet.com> (raw)
In-Reply-To: <001001c29ac9$8f8de3e0$0b00010a@aip.com.br>

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




view thread (18+ messages)  latest in thread

Message-ID: <Pine.LNX.4.44.0212031503390.6454-100000@matrix.gatewaynet.com>
Permalink:  ../Pine.LNX.4.44.0212031503390.6454-100000@matrix.gatewaynet.com/
Also on:    postgresql.org/message-id/Pine.LNX.4.44.0212031503390.6454-100000@matrix.gatewaynet.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: achill@matrix.gatewaynet.com, pedroigor@aip.com.br
  Subject: Re: SQL QUERY
  In-Reply-To: <Pine.LNX.4.44.0212031503390.6454-100000@matrix.gatewaynet.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox