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

Add information to our type mappings whether the literal SQL representation defaults to the store type #30605

Open
roji opened this issue Apr 1, 2023 · 0 comments

Comments

@roji
Copy link
Member

roji commented Apr 1, 2023

For some store types, their literal SQL representation automatically gets evaluated by the database to be that type; this is the case e.g. for int (SELECT 8 returns an int). But for others that's not the case, i.e. the literal representation of smallint is also 8, but that gets evaluated as int.

We can add a flag on our type mappings which says if the SQL literal representation maps back to the type; this could allow us to omit explicit conversions in some cases.

  • When generating a VALUES expression, we add explicit conversion to make sure the right store type comes out.

Note relationship with #27150: the literal representation of bool in SQL Server is CAST(1 AS BIT), which is there to fix mitigate #24075 (projecting out), but causes perf issues. We could try to add the CAST only where needed (VALUES, when projecting out) rather than everywhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants