-
Notifications
You must be signed in to change notification settings - Fork 16
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
Is this expected a bind to BIGINT to be surrounded by quotes? #82
Comments
interesting. One thing is that if it is quoted then it will automatically cast. That said I doubt there is a reason to cast it. |
It is automatically cast when using a plain SQL. In JDBC if you use the parameter in the prepared statement and set a String object then an error is thrown due to incompatible types.That JDBC failure was the reason to end up looking at this in ODBC. The error In JDBC when assigning is the following (only using a parameter at the statement, not with explicit text literal):
|
So you are using setString to set a bigInt ? |
Well it is a bit more complicated Think on it as a middleware receiving the query from ODBC and generating a delegation to JDBC.
This is more or less how ended up asking for the reason to format the bigint binding with quotes in ODBC :) |
Ok, the JDBC driver uses V3 protocol so it will attempt to bind that ? to a string. It has no idea that the actual field is a bigint. Dave |
I was testing the folowing:
When I execute I see that the executed sentence does contain the number quoted. Example (probably not exactly from the same test than previous trace logs):
[14.554]PQsendQuery: 00000000005B4DB0 'BEGIN;declare "SQL_CUR000000000053DB60" cursor with hold for select * from public.testview where longfield< '5545';fetch 10000 in "SQL_CUR000000000053DB60"'
I think the reason for SQL_INTEGER and SQL_SMALLINT not being quoted (or quoted with ::int4) is in convert.c#L5310 but I don't figure out why this is not the same for SQL_BIGINT.
It is not throwing an error but does not seems correct to me to use a text literal there
The text was updated successfully, but these errors were encountered: