[HACKERS] Review of DDL replication solution
Hello! I am new to Postgres backend development, and have created a recent project that has minimal C code. It is a transparent DDL replication solution built on top of pglogical, but with a concept that could be used also with other logical replication solutions if they support some mechanism to propagate SQL to subscribers. I describe some of its limitations in the docs: https://github.com/enova/pgl_ddl_deploy I would greatly appreciate some critique/review of the C code in particular: https://github.com/enova/pgl_ddl_deploy/blob/master/pgl_ddl_deploy.c It is extremely simple and most of the code is shared from other existing Postgres code. But if we put this into production, I'd love for some more experienced devs to at least take a look at it. Likewise, I would love if in general anyone would try to see if using this is feasible in their environment. I have posted already on the bdr/pglogical list, but would also like to share this with the broader community. I appreciate all positive/negative feedback. Cheers! Jeremy Finzel (DBA at Enova International)
[HACKERS] Is it possible to get query_string value in an event trigger?
Hello. Is it possible to get the currently executing query in an event trigger, for example, a create table event trigger function firing after ddl_command_end, aside from checking pg_stat_activity for the current process? When I am debugging the source code, after executing a statement I can see the variable query_string which has the entire SQL statement, however, I would be very interested if it's possible to get this query_string value in a c function called during an event trigger, for a given process, or if by that time the memory has been freed and/or it's just not possible for some other reason to get the query string of a particular process. Any thoughts much appreciated.