Skip to content

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.

2 participants