Skip to content

Python: Fix postgres filter bug - #14497

Merged
westey (westey-m) merged 6 commits into
microsoft:mainfrom
westey-m:python-postgres-filter-bugfixes
Oct 1, 2026
Merged

westey (westey-m) merged 6 commits into
microsoft:mainfrom
westey-m:python-postgres-filter-bugfixes

Conversation

@westey-m

Copy link
Copy Markdown
Contributor

Motivation and Context

Description

  • Improve PostgreSQL query construction for search filters.
  • Expand unit and integration coverage for filtered searches.
  • Clarify supported filter input in the connector documentation.

Contribution Checklist

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Fix the syntax error and correctly translate None comparisons to IS NULL/IS NOT NULL.

Review effort: Lite
Findings: 1 High severity · 1 Medium severity

Open (2)
What changed in this PR

This PR improves PostgreSQL filter construction, expands test coverage, and documents supported filter syntax.

Changes:

  • Parameterizes filter values.
  • Adds unit and integration coverage.
  • Documents supported filter inputs.
File Summary
python/​tests/​unit/​connectors/​memory/​test_postgres_store.py Reviewed expanded filter parsing and query tests.
python/​tests/​integration/​memory/​postgres/​test_postgres_int.py Reviewed filtered-search integration coverage.
python/​semantic_kernel/​connectors/​postgres.py Found an import-blocking syntax error and incorrect None comparison SQL semantics.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread python/semantic_kernel/connectors/postgres.py
Comment thread python/semantic_kernel/connectors/postgres.py
@github-actions

github-actions Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
connectors
   postgres.py3813989%139, 157, 184, 297–298, 388, 394–396, 401–402, 404–405, 412, 434, 490, 492, 494, 511, 523, 573, 582, 632, 652, 672, 677, 683, 695, 725, 729, 731, 753, 780, 785, 939, 943, 970–972
TOTAL29063549681% 

Python Unit Test Overview

Tests Skipped Failures Errors Time
4241 22 💤 0 ❌ 0 🔥 2m 12s ⏱️

@semantic-kernel-automation semantic-kernel-automation Bot added the python Pull requests for the Python Semantic Kernel label Sep 29, 2026
@westey-m
westey (westey-m) added this pull request to the merge queue Sep 30, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Sep 30, 2026
@westey-m
westey (westey-m) added this pull request to the merge queue Sep 30, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Sep 30, 2026
@westey-m
westey (westey-m) added this pull request to the merge queue Oct 1, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 1, 2026
@westey-m
westey (westey-m) added this pull request to the merge queue Oct 1, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 1, 2026
@westey-m
westey (westey-m) added this pull request to the merge queue Oct 1, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 1, 2026
@westey-m
westey (westey-m) added this pull request to the merge queue Oct 1, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 1, 2026
@westey-m
westey (westey-m) added this pull request to the merge queue Oct 1, 2026
Merged via the queue into microsoft:main with commit 9974625 Oct 1, 2026
32 checks passed
@westey-m
westey (westey-m) deleted the python-postgres-filter-bugfixes branch October 1, 2026 18:26
alexcastgonz (pcbeingused333) pushed a commit to pcbeingused333/semantic-kernel that referenced this pull request Oct 26, 2026
…4313)

Postgres search filters must produce SQL predicates with their values
passed separately as ordered parameters. Extend the search execution
tests to cover callable filters, single-item and empty lists, and mixed
string/callable lists, including OR grouping, across all five supported
distance functions and both result-consumption paths.

The parameterized connector implementation from microsoft#14497 is preserved. The
diff against main is limited to test coverage and adds 30 cases. Related
to microsoft#14311.

Validation on Python 3.12:

- Postgres connector unit tests: 127 passed.
- Shared data/vector unit tests: 76 passed.
- Repository pre-commit checks for the Postgres connector and test file:
passed, including Ruff, formatting, Python syntax, pyupgrade, and
Bandit.

The tests inspect the SQL and ordered parameters passed to the mocked
Postgres cursor; no live database is required.

Co-authored-by: Eduard van Valkenburg <eavanvalkenburg@users.noreply.github.com>

This branch was previously deployed

1 inactive deployment
github-app-auth — 0c03399e Deployed Oct 1, 2026 by westey-m via add_label #29213
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Pull requests for the Python Semantic Kernel

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants