From 86b70e607525d848c096fe71015881910ac30618 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Sirois Date: Fri, 15 May 2026 18:03:00 +0400 Subject: [PATCH] fix: mark getQuerySource as introspection so it survives reset filter Postgres strips trailing comments past `;` from the text pg_stat_statements stores, so the marker has to sit before the terminator. Without it, the getQuerySource SELECT survived pg_stat_statements_reset() and broke the non-default-schema reset test. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/sync/pg-connector.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/sync/pg-connector.ts b/src/sync/pg-connector.ts index fb3c8e3..3a95c99 100644 --- a/src/sync/pg-connector.ts +++ b/src/sync/pg-connector.ts @@ -467,11 +467,15 @@ ORDER BY } private async getQuerySource(): Promise { + // The marker must sit before the terminating semicolon — Postgres strips + // trailing comments past `;` from the text that pg_stat_statements stores, + // which would let this query bypass the introspection filter in + // getRecentQueries() and surface after pg_stat_statements_reset(). const results = await this.db.exec<{ schema: string; extension: string }>(` SELECT e.extname as extension, n.nspname as schema FROM pg_extension e JOIN pg_namespace n ON n.oid = e.extnamespace - WHERE e.extname IN ('pg_stat_statements', 'pg_stat_monitor'); + WHERE e.extname IN ('pg_stat_statements', 'pg_stat_monitor') -- @qd_introspection `); const firstResult = results[0]; if (!firstResult) {