Skip to content

fix: keep getQuerySource out of getRecentQueries after reset#136

Merged
veksen merged 1 commit into
mainfrom
veksen/update-branch-name
May 15, 2026
Merged

fix: keep getQuerySource out of getRecentQueries after reset#136
veksen merged 1 commit into
mainfrom
veksen/update-branch-name

Conversation

@veksen
Copy link
Copy Markdown
Member

@veksen veksen commented May 15, 2026

Summary

  • The non-default-schema reset test (resetPgStatStatements works with a non-default schema) was failing with expected 1 to deeply equal +0 — one query survived pg_stat_statements_reset().
  • Root cause: getQuerySource() had no @qd_introspection marker AND its IN-list literals normalize to $1, $2, so neither filter in getRecentQueries() caught it.
  • Adding -- @qd_introspection after the trailing ; didn't help: Postgres strips trailing comments past ; from the text pg_stat_statements stores (verified empirically). Moved the marker before the terminator so it actually survives.

Test plan

  • npx vitest run src/sync/pg-connector.test.ts — all 7 tests pass locally against postgres:17
  • Re-run the CI Release Action job and confirm it gets past this test

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) <noreply@anthropic.com>
Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Query Doctor Analysis

View full run details

2 queries analyzed

2 pre-existing issues

Using assumed statistics (10000000 rows/table). For better results, sync production stats.

@veksen veksen merged commit 5650215 into main May 15, 2026
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants