return value of the trigger function

From: Jarek Pudełko <jarek(dot)pudelko(at)tech(dot)ceti(dot)pl>
To: pgsql-sql(at)postgresql(dot)org
Subject: return value of the trigger function
Date: 2005-01-10 14:15:33
Message-ID: 41E28E05.2040307@tech.ceti.pl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi

I have big problem with a trigger function.
Defs:

CREATE TABLE foo (id int2, name varchar(20));

foo.id cannot be serial or autoint because it will not be unique.

Now I need a trigger that return foo.id of the inserted record.

INSERT INTO foo VALUES (max(foo.id)+1,'junk');

IMHO the trigger should be:

CREATE TRIGGER tr_get_new_id
AFTER INSERT on foo
ON EACH ROW
EXECUTE PROCEDURE get_new_id();

But I cannot create the function :(
I don't know what type should be input and how about output? trigger or
int2?

TIA,

--
Jarek Pudelko
JP272-RIPE

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message none none 2005-01-10 17:43:03 TEXT type blob extraction in ecpg
Previous Message Michael Ossareh 2005-01-10 10:00:00 SQL Query Performance tips