Query Parameter Integer

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

2 answers

1 accepted

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 smile. In that case, please write a short mail to atlassian[at]scandio.de

Regards, Felix (Scandio)

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?

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.

Thanks again, I will wait for the release as I still have to explore a lot in Confluence.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jul 10, 2018 in Confluence

We want to see the templates you've created in Confluence!

Hi Community, Jessica here from the Confluence Product Marketing team!  July’s community challenge is all about sharing pictures  — and as an extension of our first post on what ...

631 views 21 11
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you