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
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?