| From: | Alke <alke(at)iol(dot)it> |
|---|---|
| To: | "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
| Subject: | OID and PL/pgSQL trigger :-( |
| Date: | 1999-08-20 20:51:07 |
| Message-ID: | 37BDBFBA.5370AFE3@iol.it |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general pgsql-sql |
Hy all!
I would like to use OIDs as a primary key on every table of my db,
because this seem to me a very smart thing to do..... but after some
experiment, I've decided to create a SERIAL field on every table, and to
use it as the primary key, and to abandon OIDs...
This is an example of what I whould like to write (and I can't):
CREATE FUNCTION firstTable_DelCascade() RETURNS OPAQUE AS '
BEGIN
DELETE FROM anotherTable WHERE anotherTable.OIDfromFirstTable =
OLD.OID;
RETURN OLD;
END;
' LANGUAGE 'plpgsql';
Well, this can't work because OLD is of type RECORD, and type record
have no OID :-(
(this is what I found in the docs, about RECORD:
"Only the user attributes of a table row are accessible in the row, no
Oid or other system attributes (hence the row could be from a view and
view rows don't have useful system attributes)" )
The main question is: can I get the OID of the OLD/NEW record in
triggers?
A more general question is: what is the usefulness of OIDs, if I can't
use them in trigger?
Paolo
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Alke | 1999-08-20 21:28:05 | Array-fields and many-to-many relations |
| Previous Message | G. Anthony Reina | 1999-08-20 17:02:30 | RE: [GENERAL] Error during 'vacuum analyze' |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Alke | 1999-08-20 21:28:05 | Array-fields and many-to-many relations |
| Previous Message | Nicolas Cadou | 1999-08-20 17:00:52 | Missing PL/pgSQL library |