Skip to content

[BUG] Schema probe on a single column returns all columns #5367

Description

@LepsyMikolaj3301

Hello,
following a recent fix of schema caching (Spark/pyspark) using the WHERE 1=0 clause in PR #4118, the RowDescription returns all columns, rather than only one, queried column.

Example (Python 3.12.7 using psycopg==3.3.3) querying lesmiserables dataset:

  1. full select
>>> SELECT * FROM Character WHERE 1=0

Description returns an array:

[<Column 'name', type: varchar (oid: 1043)>, <Column '@rid', type: varchar (oid: 1043)>, <Column '@type', type: varchar (oid: 1043)>, <Column '@cat', type: "char" (oid: 18)>]
  1. 'name' Column only
>>> SELECT name FROM Character WHERE 1=0

Description returns an array:

[<Column 'name', type: varchar (oid: 1043)>, <Column '@rid', type: varchar (oid: 1043)>, <Column '@type', type: varchar (oid: 1043)>, <Column '@cat', type: "char" (oid: 18)>]

Expected: [<Column 'name', type: varchar (oid: 1043)>]

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions