| From: | Rick Schumeyer <rschumeyer(at)ieee(dot)org> |
|---|---|
| To: | pgsql-general(at)postgresql(dot)org |
| Subject: | Using a trigger with an object-relational manager |
| Date: | 2007-05-23 01:21:56 |
| Message-ID: | 46539734.3040606@ieee.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
I'm using Ruby on Rails and have two tables, A and B. Every row in A
needs a corresponding row in B. A also contains a FK pointing to B.
I created a before insert trigger on A that inserts a new row in B, and
sets the FK in A. This seems to be running fine.
The problem is that the new A object that rails gets does not see the
effect of the trigger. If I call the "reload" method, then everything
is ok.
I'm not sure if this is a rails specific problem, or if there is an
adjustment I can make to my SQL to avoid the need for the reload.
Can I somehow put the creation of A, B and setting the FK in a
transaction so that rails receives the row from A after the trigger
completes? If so, I'm not sure the best way to do that.
Thanks for any suggestions!
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Naz Gassiep | 2007-05-23 02:12:52 | Integrity on large sites |
| Previous Message | EMS Database Management Solutions (SQLManager.net) | 2007-05-23 00:47:46 | SQL Manager 2007 for PostgreSQL released |