Comments (2)
Ultimately I decided to hack this in by sniffing the connection type at runtime, in order to satisfy Postgres's very picky typechecker. Thankfully there was already a DbType produced by the RZSQL typechecker available with the array parameter.
As of 0.6.2, behavior for IN
with an empty array is:
SQLite (unchanged):
x IN ()
Postgres:
x IN (SELECT NULL::numeric WHERE FALSE)
numeric
could also be text
, timestamptz
, bytea
or uuid
depending on the parameter type associated with the empty array (inferred by the RZSQL compiler, so should "just work" in terms of matching the type of x
enough to satisfy PG).
All others:
x IN (SELECT NULL WHERE 1=0)
from rezoom.sql.
Good catch. I started with SQLite which accepts this syntax (it's pretty liberal about a lot of things).
The tricky part about fixing this is that the (comma,separated,list)
part of these IN @whatever
expressions gets generated at runtime, and currently is unaware of the backend in use. So to fix this without making a bigger change to expose the backend at runtime, it'd have to be something that works on all DBs.
At first I thought simply translating an empty array to (SELECT NULL WHERE 1=0)
would work. That would be a 5-second fix, but it seems it doesn't work on Postgres because PG can't figure out the row type of the subquery.
I'll think about this a little more. Probably the best approach will be to refactor so that the backend can be used at runtime, which will be helpful in the long run anyway.
from rezoom.sql.
Related Issues (20)
- Bug: Batching results over large queries HOT 2
- Plan execution with transaction HOT 2
- Error using LIMIT with a parameter HOT 2
- Duplicate columns in Insert statements do not show as error HOT 2
- Can you call stored procedures? HOT 1
- Error when following tutorial HOT 1
- Type provider doesn't work with FParsec-Pipes 1.0.0 HOT 1
- Generated code doesn't work with LicenseToCIL 1.0.0 HOT 1
- Error in dynamicCommand HOT 1
- Increase Command Timeout HOT 1
- Path to 1.0.1 HOT 4
- issue using nuget package from FSI HOT 3
- Data type/column type: array HOT 3
- Less horrible way to run migrations with dynamic connection string? HOT 1
- Support for Geography types
- Create / Drop Schema support HOT 1
- Visual Studio gives errors when used with the .NET Standard branch HOT 9
- Any hope for custom types/serializers?
- Dacpac support info HOT 1
- fsprojects onboarding HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rezoom.sql.