On 14.10.25 13:13, Matěj Klonfar wrote:
certain instrumentation tools do prefix each statement with an informational comment, typically to provide some tracing information to logs (datadog for example). While this works for SQL statements, it's not possible with logical replication statements because their grammar doesn't support comments and it is causing unnecessary syntax errors.

I can imagine this limitation is likely a holdover from the system's evolution from physical replication where comments make no sense. However, in logical replication walsender mode both SQL and replication statements can be issued [1], so the current state brings the necessity to distinguish when to inject the comment and when not to. What do you feel, are there any unexpected impacts of extending the replication grammar with comments?

Another approach could be to get rid of repl_scanner.l and use the main scanner. This would be similar to how plpgsql works.



Reply via email to