Hello,
I am trying out Confluence and PocketQuery.
I created a small Query with a parameter.
SELECT * FROM retail where customerid = 324234
customerid column is int4.
When I add a PocketSQL to a site and define the paramter I get the following StackTrace
org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [SELECT * FROM retail WHERE customerid= ?]; nested exception is org.postgresql.util.PSQLException: ERROR: operator does not exist: integer = character varying Hint: No operator matches the given name and argument type(s). You might need to add explicit type casts
How do I tell the macro that my input is an integer?
Thank you for your help
Hi Thomas,
Actually this is a SQL function. When you insert directly a number as parameter it will automatically convert to text. Try to use as follows:
SELECT * FROM retail where customerid = '324234'
More information can be found at the page below:
http://stackoverflow.com/questions/24751372/no-function-matches-the-given-name-and-argument-types
Hope this helps.
Cheers
Hi Thomas,
As Thiago already wrote correctly, this is how the underlying Spring JDBC libraries handle "Named Parameter Statements". By default, the parameters in these statements will be replaced as strings before the statement is executed. In the current public version of PocketQuery, I believe there is no workaround for this. But: we are just a few steps away from releasing PocketQuery 2.0 which has a feature for exactly this purpose. If you're interested, I will send you a release-candidate version and tell you how the feature works . In that case, please write a short mail to atlassian[at]scandio.de
Regards, Felix (Scandio)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello, thank you for your explanation. I couldn't answer yesterday. As per PostgreSQL documentation A numeric constant that contains neither a decimal point nor an exponent is initially presumed to be type integer. Shouldn't be this the default for Pocket also?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
We're kind of dependent on how the Spring JDBC libraries handle this. It's kind of more low-level than the implementation of PocketQuery. As I said, I can provide you a release candidate version via mail that has a feature by which you can specify a type for each parameter in your statement.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks again, I will wait for the release as I still have to explore a lot in Confluence.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.