Postgresql post_parse_analyze_hook not getting triggered for COMMIT command

Поиск
Список
Период
Сортировка
От Soumya Prasad Ukil
Тема Postgresql post_parse_analyze_hook not getting triggered for COMMIT command
Дата
Msg-id 569458024.606881.1620223463206@mail.yahoo.com
обсуждение исходный текст
Список pgsql-general
Hello All,

I am trying to build a postgres extension and I have installed the following hooks using this document https://wiki.postgresql.org/images/e/e3/Hooks_in_postgresql.pdf 

The hooks that I have installed in my extension are the followings:
  • shmem_startup_hook
  • post_parse_analyze_hook
  • ExecutorStart_hook
  • ExecutorRun_hook
  • ExecutorFinish_hook
  • ExecutorEnd_hook
  • ProcessUtility_hook
Post that I am using a java program like below to fire sql statements in a transaction:

Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
// insert an actor into the actor table
String SQLInsertActor = "INSERT INTO actor(first_name,last_name) VALUES(?,?)";
try {
// connect to the database
conn = connect();
conn.setAutoCommit(false);
int i=0;
while (i < 5) {
// add actor
pstmt = conn.prepareStatement(SQLInsertActor, Statement.RETURN_GENERATED_KEYS);
pstmt.setString(1, actor.getFirstName());
pstmt.setString(2, actor.getLastName());
pstmt.executeUpdate();
// commit the transaction if everything is fine
conn.commit();
i++;
}
}
Now what is happening I am receiving all the hook call backs for INSERT statement always. BEGIN and COMMIT being utility statement hooks come for parse, process utility hook, . However from second iteration onwards, while BEGIN throws parse callback, but COMMIT command does not throw parse callback. It directly throws process utility hook.
Can you please help why second iteration onwards, commit does not throw parse callback to extension?

В списке pgsql-general по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: PostgreSQL upgrade from 10 to 12 fails with "ERROR: column r.relhasoids does not exist at character 1616"
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Strange behavior of function date_trunc