Skip to content

Python: Reject skip with key lookup in PostgreSQL and DuckDB collections - #10207

Open
Wilson_Jiang (Wilson0511) wants to merge 1 commit into
microsoft:mainfrom
Wilson0511:fix/key-lookup-skip-guard
Open

Wilson_Jiang (Wilson0511) wants to merge 1 commit into
microsoft:mainfrom
Wilson0511:fix/key-lookup-skip-guard

Conversation

@Wilson0511

Copy link
Copy Markdown
Contributor

Python: Reject skip with key lookup in PostgreSQL and DuckDB collections

Description

get(keys=..., skip=N) silently dropped the explicit skip in the PostgreSQL and DuckDB _inner_get key branches — the unshifted key query was built and run, so the same portable call succeeded here while MongoDB, Qdrant, and Oracle raise ValueError for it (and core itself raises for keys+filter as alternate retrieval modes). Both key branches now reject skip with the same message shape as their siblings, matching their existing order_by guard.

keys+top remains as-is everywhere except Oracle; that divergence is a separate design call (noted in the linked issue).

Fixes #10206

Tests

  • test_key_retrieval_rejects_skip in both packages: get(["key"], skip=1) raises ValueError matching "cannot be combined with skip"; get(skip=1) without keys still works. Red on main (DuckDB repro returns the record with skip silently dropped — Failed: DID NOT RAISE), green with the guards. DuckDB runs against the existing in-memory fixture; PostgreSQL's guard fires before any connection so the test is fully offline.

Attribution

Developed with AI assistance (model: GLM-5.3 via ZCode; Co-Authored-By trailer on the commit). Found by census-ing the key-lookup guard sets across all vector-store connectors after the stores family sweep; diff reviewed in the authoring context, no separate fresh-context pass. Integration tests requiring live PostgreSQL: not run locally.

get(keys=..., skip=N) silently dropped the explicit skip in the
PostgreSQL and DuckDB _inner_get key branches — the unshifted key query
was built and run, so the same portable call succeeded here while
MongoDB, Qdrant, and Oracle raise ValueError for it (and core itself
raises for keys+filter as alternate retrieval modes). Both key branches
now reject skip with the same message shape as their siblings, next to
their existing order_by guard.

Co-Authored-By: ZCode <zcode@bigmodel.ai>

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.

🟢 Approval recommended

No active review issues are recorded for the change aligning PostgreSQL and DuckDB key-lookup behavior with other connectors.

No open issues 🎉

What changed in this PR

Addresses #10206 by making PostgreSQL and DuckDB reject nonzero skip during key lookup, aligning their behavior with MongoDB, Qdrant, and Oracle.

Changes:

  • Add ValueError guards for key retrieval combined with skip.
  • Add regression tests for both connectors, including a DuckDB check that listing without keys still accepts skip.
  • Leave keys+top behavior unchanged.
File Description
python/​packages/​postgres/​tests/​test_postgres.py Adds an offline regression test for rejecting keys with skip.
python/​packages/​postgres/​agent_framework_postgres/​_vector_store.py Rejects nonzero skip in PostgreSQL key lookups.
python/​packages/​duckdb/​tests/​duckdb/​test_collection.py Tests rejection and preserves listing support for skip.
python/​packages/​duckdb/​agent_framework_duckdb/​_vector_store.py Rejects nonzero skip in DuckDB key lookups.

Review effort: Balanced

@eavanvalkenburg

Copy link
Copy Markdown
Member

Wilson_Jiang (@Wilson0511), the current-head code review is clean and checks are green. Before approval, please update the PR description to include the repository template's Contribution Checklist, including contribution-guideline compliance, the agreed-issue/no-competing-PR attestation, and breaking-change status. The prose AI disclosure is sufficient for review; missing the checkbox alone is not a blocker.

This branch was previously deployed

1 inactive deployment
github-app-auth — 303692e1 Deployed Nov 9, 2026 by Wilson0511 via team_check #9044
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Usage: [Issues, PRs], Target: Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python: get(keys=..., skip=N) diverges across vector-store connectors: PostgreSQL and DuckDB silently drop the explicit skip

3 participants