0

I have a problem with existing database code (a trigger) that call a function trigger that use the NOTIFY command, which is not supported in the context of a prepared transaction.

My question is simple : from the function trigger, is there a way to detect that we are in the context of a prepared transaction ?

Thanks in advance.

4

1 回答 1

1

使用prepared transactions和两阶段提交没有办法检测到当前事务会被提交,因为你还没有PREPAREd事务;在触发器运行之前,事务不知道它会经历两阶段提交。PostgreSQL 不需要你BEGIN TRANSACTION FOR TWO PHASE COMMIT(想象的语法)或类似的东西。

您可以测试max_prepared_transactions> 0 inpg_settings以查看是否启用了准备好的事务,但是在它发生之前无法知道是否会使用 2PC。

于 2013-01-22T08:18:24.713 回答