From: | Andre Lopes <lopes80andre(at)gmail(dot)com> |
---|---|
To: | postgresql Forums <pgsql-general(at)postgresql(dot)org> |
Subject: | Transactions and ID's generated by triggers |
Date: | 2011-02-27 20:34:19 |
Message-ID: | AANLkTi=0C=z17g5XsWF8y60tV6V2qUV-raZjVxWLJZHm@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi,
I have a situation that I dont know how to deal.
I have 2 tables "tdir_uris_files" and "tdir_uri_files_details". Please
see the Image in attach.
The table "tdir_uris_files" have the field "id_ordinal" that is
originated by a trigger(before insert)
The table "tdir_uri_files_details" use the field "id_ordinal"
generated by trigger on the insert on the table "tdir_uris_files"
Now my doubt. It is possible to do a transaction to this two tables at
the same time?
How can I know the value of the field "id_ordinal" that was generated
by the trigger?
Can I be able to do this?
[code]
BEGIN;
INSERT INTO tdir_uris_files (uri, id_language, id_category,
id_file_context, id_encode_format, n_file, file)
values (...)
INSERT INTO tdir_uri_files_details (uri, id_language, id_category,
id_file_context, id_ordinal, id_file_type, id_file_detail, value)
values (...);
COMMIT;
[/code]
PS: Sorry my bad english.
Best Regards,
Attachment | Content-Type | Size |
---|---|---|
image/png | 14.3 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Sullivan | 2011-02-27 20:57:31 | Re: PG on two nodes with shared disk ocfs2 & drbd |
Previous Message | Adrian Klaver | 2011-02-27 20:26:38 | Re: Hot Standby - ERROR: canceling statement due to conflict with recovery |