-
-
Notifications
You must be signed in to change notification settings - Fork 478
Query fails in redshift. #330
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
Comments
It looks like Redshift is looking for a |
Even though the column is a integer which according to the docs is |
Oh wait, I was responding to the initial error of |
I had the column as biginteger so I changed it to integer which it should have been. Sorry I should have maybe created another issue. |
The Redshift docs claim that arrays aren't supported at all, but I'm not sure why a query using them would fail in that way: https://docs.aws.amazon.com/redshift/latest/dg/c_unsupported-postgresql-datatypes.html. |
That's weird as I can issue Also I am using ANY here as I don't think the IN clause works with rust-postgres ? |
It works just fine - it just takes a sequence of separate values rather than an array of values. One possibility is that Redshift is forked off of Postgres 8.1 or older, where they didn't support null array elements (support was added in 2005!). We should be able to make this work by only setting the null flag if there are actually null values. |
I have tried the IN clause now as well. (hacked as a single str) ie From rust-postgres I get the same error of invalid array flags |
If that exact query generates that error, then that seems like a bug on the Redshift side of things. We're not producing any arrays in that case, we're just sending a string to Redshift. |
Odd. If I copy and paste that query into my ide (datagrip) it works fine. |
Out of curiosity is there away to pass an array to a sequence so I can do something like
|
Nope - #326 (comment) |
Ok I got the In clause working. So to recap in redshift
works. Thanks |
Wait, so even |
This is necessary to support arrays of non-null values on Postgres 8.1 and older. Closes #330
Hi
I have some code of a simple query
let results : postgres::Result<Rows> = self.conn.query("SELECT id, name FROM sensors WHERE id = ANY($1)", &[&sensor_ids]);
where
sensor_ids is sensor_ids : Vec<i32>
This works fine against my local postgres db (9.5)
I am now trying to move to redshift but I get the error
Err(Error(Db(DbError { severity: "ERROR", parsed_severity: None, code: SqlState("22P03"), message: "invalid array flags", detail: None, hint: None, position: None, where_: None, schema: None, table: None, column: None, datatype: None, constraint: None, file: Some("/home/ec2-user/padb/src/pg/src/backend/utils/adt/arrayfuncs.c"), line: Some(1174), routine: Some("array_recv") })))
Any idea what this could be ?
PS.
If I query through my ide
SELECT id, name FROM sensors WHERE id = ANY(ARRAY[596304,597992,610978,597998])
It works
Thanks
The text was updated successfully, but these errors were encountered: