From: | "Rod Taylor" <rod(dot)taylor(at)inquent(dot)com> |
---|---|
To: | "Hackers List" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | OLD.oid issues... |
Date: | 2001-01-18 19:42:20 |
Message-ID: | 03d601c08186$d50d18e0$6500000a@jester |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Doesn't appear that you can use OLD.oid in triggers (actually does more, =
but thats good enough):
CREATE FUNCTION history_update_delete() RETURNS OPAQUE AS '
DECLARE
v_tablename varchar(40);
v_history_tablename varchar(48);
v_operation varchar(6);
BEGIN
v_operation :=3D TG_OP;
v_tablename :=3D TG_RELNAME;
v_history_tablename :=3D ''history_'' || v_tablename;
INSERT INTO v_history_tablename SELECT ''v_operation'' as =
history_change_type
, OLD.oid as orignal_oid
, *
FROM v_tablename
WHERE oid =3D OLD.oid;
RETURN NEW;
END;
' LANGUAGE 'plpgsql';
--
ERROR: record old has no field oid
The below also fails.
create table example (
original_oid oid REFERENCES table(oid)
ON UPDATE CASCADE
ON DELETE SET NULL
);
--
ERROR: UNIQUE constraint matching given keys for reference table "table" not found
Postgresql 7.1beta3. I'd consider these to be bugs myself but I've not =
tried them in previous versions to know if it's really just a new =
feature :)
--
Rod Taylor
There are always four sides to every story: your side, their side, the truth, and what really happened.
Attachment | Content-Type | Size |
---|---|---|
Taylor, Rod B.vcf | text/x-vcard | 451 bytes |
From | Date | Subject | |
---|---|---|---|
Next Message | Hannu Krosing | 2001-01-18 19:46:38 | Re: converting from text -> inet ... possible? |
Previous Message | Tom Lane | 2001-01-18 19:06:28 | Re: Changes to include files |