Skip to content

Add a blob IN filter pushdown test (depends on database-connector#25)#534

Merged
staticlibs merged 1 commit into
duckdb:mainfrom
marknefedov:fix/blob-in-pushdown-constant-config
Jul 25, 2026
Merged

Add a blob IN filter pushdown test (depends on database-connector#25)#534
staticlibs merged 1 commit into
duckdb:mainfrom
marknefedov:fix/blob-in-pushdown-constant-config

Conversation

@marknefedov

Copy link
Copy Markdown

Blocked on duckdb/database-connector#25 — CI will be red until that merges and the submodule pointer is bumped.

What this is

The SQL-level regression test for the blob IN pushdown bug. The fix itself is one line in the database-connector submodule (duckdb/database-connector#25); only the test belongs in this repo.

The bug

FilterPushdown::TransformExpression serialises COMPARE_IN constants with identifier_config, whose blob literal prefix and suffix are empty, while EncodeBlob appends the closing quote unconditionally. With this repo's configuration ('\x prefix and ::BYTEA suffix, set in src/postgres_filter_pushdown.cpp:37) a blob IN list is emitted as:

"blob_col" IN (6470666B67', 6F74686572')

Postgres rejects it with trailing junk after numeric literal, so WHERE blob_col IN (...) against an attached table fails outright. The = path was never affected — it already used constant_config.

The test

test/sql/storage/filter_pushdown_blob_in.test runs blob IN / NOT IN filters against an attached Postgres table, including a six element list (the binder is more likely to keep a longer list as a COMPARE_IN rather than rewriting it to an OR chain) and blobs containing quote and backslash bytes. With the bug present these fail with the Postgres syntax error rather than returning wrong rows.

To land

  1. Merge Use the constant config when writing blob IN list literals database-connector#25
  2. Bump the database-connector submodule pointer on this branch
  3. CI goes green, undraft

The COMPARE_IN branch of FilterPushdown::TransformExpression serialized
its constants with identifier_config, whose blob_literal_prefix and
blob_literal_suffix are empty. QueryWriter::EncodeBlob appends the
closing quote unconditionally, so a blob IN list came out as

  "blob_col" IN (6470666B67', 6F74686572')

and Postgres rejected it with 'trailing junk after numeric literal'. The
equality path already used constant_config via TransformConstantFilter,
so only IN lists were affected.
@staticlibs staticlibs reopened this Jul 25, 2026
@staticlibs
staticlibs marked this pull request as ready for review July 25, 2026 11:16

@staticlibs staticlibs left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for adding the test!

@staticlibs
staticlibs merged commit 4daa465 into duckdb:main Jul 25, 2026
4 of 10 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