Skip to content

Conversation

@akuzm
Copy link
Contributor

@akuzm akuzm commented Oct 11, 2022

This query only requires counting rows, so it is optimized into selecting a rowid column from the underlying table. In case of the Postgres table, this gets deparsed into selecting the first column. If it happens to be a text column, we then try to insert it into the rowid output vector which is int, and fail with an assertion because of type mismatch.

Instead of this, deparse this case into SELECT NULL FROM postgres_table. This is enough for counting the rows.

This query only requires counting rows, so it is optimized into
selecting a rowid column from the underlying table. In case of the
Postgres table, this gets deparsed into selecting the first column. If
it happens to be a text column, we then try to insert it into the rowid
output vector which is int, and fail with an assertion because of type
mismatch.

Instead of this, deparse this case into SELECT NULL FROM
postgres_table. This is enough for counting the rows.
@Mytherin Mytherin merged commit 167b0e2 into duckdb:main Oct 27, 2022
@Mytherin
Copy link
Contributor

Thanks for the PR! Looks good to me.

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