pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedexpected trigger behavior in transactions
3+ messages / 2 participants
[nested] [flat]
* expected trigger behavior in transactions
@ 2004-08-30 17:01 Noah Davis <noah@acadaca.com>
0 siblings, 1 reply; 3+ messages in thread
From: Noah Davis @ 2004-08-30 17:01 UTC (permalink / raw)
To: pgsql-jdbc
Hi,
Forgive me if this isn't directly a JDBC issue.
I have some triggers setup in postgres that are triggered before inserts.
They are pretty basic triggers. They update some columns and then continue
on with the insert.
We have some java code which starts a transaction (sets auto commit to
false) and then performs some inserts. If successful, it commits the
transaction. Sometimes, it appears like the trigger is fired but does not
commit. Is there a separate connection context for triggers? Do I have to
worry about how triggers work within a transaction? If I commit/rollback an
insert, does it commit/rollback the triggers which were fired?
It seems like when I do the steps directly in postgres, the triggers are
fired appropriately if in a transaction. However, within Java, in some cases
the triggers either aren't fired, or are fired, but do not commit when jdbc
commits. Any ideas what's going on here?
Thanks for any help,
Noah
______________________________________________
Noah Davis
636 Broadway, Suite 516
New York, New York 10012
p: 212.505.5885
f: 212.505.5655
noah@acadaca.com
<blocked::http://www.acadaca.com/; www.acadaca.com
Attachments:
Acadaca.jpg (image/jpeg, 8.2K) download
view image
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: expected trigger behavior in transactions
@ 2004-08-30 17:29 Dave Cramer <pg@fastcrypt.com>
parent: Noah Davis <noah@acadaca.com>
0 siblings, 1 reply; 3+ messages in thread
From: Dave Cramer @ 2004-08-30 17:29 UTC (permalink / raw)
To: Noah Davis <noah@acadaca.com>; +Cc: pgsql-jdbc
Noah,
Can you please post in plain text?
I'd suggest looking at the postgresql logs to see what is really going
on.
There are no "special" contexts.
Dave
On Mon, 2004-08-30 at 13:01, Noah Davis wrote:
> Hi,
>
> Forgive me if this isn't directly a JDBC issue.
>
> I have some triggers setup in postgres that are triggered before
> inserts. They are pretty basic triggers. They update some columns and
> then continue on with the insert.
>
> We have some java code which starts a transaction (sets auto commit to
> false) and then performs some inserts. If successful, it commits the
> transaction. Sometimes, it appears like the trigger is fired but does
> not commit. Is there a separate connection context for triggers? Do I
> have to worry about how triggers work within a transaction? If I
> commit/rollback an insert, does it commit/rollback the triggers which
> were fired?
>
> It seems like when I do the steps directly in postgres, the triggers
> are fired appropriately if in a transaction. However, within Java, in
> some cases the triggers either aren't fired, or are fired, but do not
> commit when jdbc commits. Any ideas what's going on here?
>
> Thanks for any help,
>
> Noah
> ______________________________________________
> Noah Davis
> 636 Broadway, Suite 516
> New York, New York 10012
> p: 212.505.5885
> f: 212.505.5655
> noah@acadaca.com
> www.acadaca.com
>
--
Dave Cramer
519 939 0336
ICQ # 14675561
www.postgresintl.com
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: expected trigger behavior in transactions
@ 2004-08-31 14:09 Noah Davis <noah@acadaca.com>
parent: Dave Cramer <pg@fastcrypt.com>
0 siblings, 0 replies; 3+ messages in thread
From: Noah Davis @ 2004-08-31 14:09 UTC (permalink / raw)
To: pgsql-jdbc; +Cc: 'Dave Cramer' <pg@fastcrypt.com>
Sorry about that. Anyhow, as sometimes happens, the problem was unrelated to
JDBC and postgres.
Thanks for your time anyhow.
-----Original Message-----
From: pgsql-jdbc-owner@postgresql.org
[mailto:pgsql-jdbc-owner@postgresql.org] On Behalf Of Dave Cramer
Sent: Monday, August 30, 2004 1:29 PM
To: Noah Davis
Cc: pgsql-jdbc@postgresql.org
Subject: Re: [JDBC] expected trigger behavior in transactions
Noah,
Can you please post in plain text?
I'd suggest looking at the postgresql logs to see what is really going on.
There are no "special" contexts.
Dave
On Mon, 2004-08-30 at 13:01, Noah Davis wrote:
> Hi,
>
> Forgive me if this isn't directly a JDBC issue.
>
> I have some triggers setup in postgres that are triggered before
> inserts. They are pretty basic triggers. They update some columns and
> then continue on with the insert.
>
> We have some java code which starts a transaction (sets auto commit to
> false) and then performs some inserts. If successful, it commits the
> transaction. Sometimes, it appears like the trigger is fired but does
> not commit. Is there a separate connection context for triggers? Do I
> have to worry about how triggers work within a transaction? If I
> commit/rollback an insert, does it commit/rollback the triggers which
> were fired?
>
> It seems like when I do the steps directly in postgres, the triggers
> are fired appropriately if in a transaction. However, within Java, in
> some cases the triggers either aren't fired, or are fired, but do not
> commit when jdbc commits. Any ideas what's going on here?
>
> Thanks for any help,
>
> Noah
> ______________________________________________
> Noah Davis
> 636 Broadway, Suite 516
> New York, New York 10012
> p: 212.505.5885
> f: 212.505.5655
> noah@acadaca.com
> www.acadaca.com
>
--
Dave Cramer
519 939 0336
ICQ # 14675561
www.postgresintl.com
---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2004-08-31 14:09 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-08-30 17:01 expected trigger behavior in transactions Noah Davis <noah@acadaca.com>
2004-08-30 17:29 ` Dave Cramer <pg@fastcrypt.com>
2004-08-31 14:09 ` Noah Davis <noah@acadaca.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox