Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use UNION ALL instead of UNION in nullable check #3605

Merged
merged 1 commit into from
Nov 26, 2024

Conversation

Suficio
Copy link
Contributor

@Suficio Suficio commented Nov 21, 2024

Instead of generating nullable query using VALUES, use UNION ALL syntax.

Current query:

SELECT NOT attnotnull FROM (
  VALUES
    ( $1::int4, $2::int4, $3::int2 ),
    ( $3::int4, $4::int4, $5::int2 ),
) AS col(idx, table_id, col_idx) ...

Becomes:

SELECT NOT attnotnull FROM (
  ( SELECT $1::int4 AS idx, $2::int4 AS table_id, $3::int2 AS col_idx )
  UNION ALL ( SELECT $1::int4, $2::int4, $3::int2 )
) AS col ...

This change allows better support for databases that support a pgwire interface but with limited SQL syntax. In particular, timeseries databases such as QuestDB and kdb are unsupported.

@abonander
Copy link
Collaborator

I'm not against merging this, but for the record I consider this a database bug.

@abonander abonander merged commit 8031460 into launchbadge:main Nov 26, 2024
81 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.

None yet

2 participants