Translating Oracle CREATE TRIGGER statement - Mailing list pgsql-novice

From Scott Cain
Subject Translating Oracle CREATE TRIGGER statement
Date
Msg-id 3E8A0D20.4010203@safehooks.org
Whole thread Raw
Responses Large table updates  (Chris Pizzo <chris@artinside.com>)
Re: Translating Oracle CREATE TRIGGER statement  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-novice
Hello,

I have no experience with Oracle or with triggers in general, but I've
been given several CREATE statements to base my Postgres schema on, but
I don't know how to translate the trigger statements.  Here is an
example Oracle create:

CREATE OR REPLACE TRIGGER fgroup_gid_ai
BEFORE INSERT ON fgroup
FOR EACH ROW WHEN (new.gid IS NULL OR new.gid = 0)
BEGIN
    SELECT fgroup_gid_sq.nextval INTO :new.gid FROM dual;
END;

While I kind of get the idea of what it is trying to do, I don't know
how to implement it in Postgres. fgroup_gid_sq is a sequence, but I have
no idea what dual is. Any advice would be appreciated.

Thanks,
Scott


pgsql-novice by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Re: [GENERAL] Postgres logs
Next
From: Chris Pizzo
Date:
Subject: Large table updates