Pocket Query: How to get around an error because of a space character in a query parameter value

Hello,

I would like to ask your help when it comes to parameters in a query. The query works ok, if the input parameter value does not contain spaces. Once it does, it gives an error. Is there a way around this please?
The example query is simple: SELECT id FROM cwd_group WHERE group_name=:GroupName
GroupName = "confluence-administrators" - no problem
GroupName = "GA Team" - gives a syntax error

org.springframework.jdbc.BadSqlGrammarException: select id from cwd_group where group_name=?

Thank you very much for your help.

1 answer

1 accepted

This widget could not be displayed.

Hi Marketa,

Thanks for raising this question! It's actually very strange -- your query works totally fine for me. I created a group with name "group with spaces". I used your statement and I simply enter the group name in the macro browser:

image2015-12-10 8:23:58.png

image2015-12-10 8:24:30.png

Did you do it the exact same way? What database are you using? Can you post your full stack trace that appears when you check the "debug" flag in the macro browser?

Regards, Felix (Scandio)

Hi Felix, more or less yes, the group query is nested in another query. {code}select user_name from cwd_user left join cwd_membership on cwd_user.id=cwd_membership.child_user_id where cwd_membership.parent_id = (select id from cwd_group where group_name=:GroupName) order by user_name asc;{code} as I actually need to get to the users of a given group. But should be the same, the result is still one row - one id that is being used further. But there is a specific thing that I didn't discover before.. it seems that it only doesn't work for one group. I have tested again a couple with spaces and worked ok, as you say. One doesn't though. After further investigation directly in DB I've found out that a couple of groups (regardles spaces in title) are stored twice!!! Same name, different IDs. What a mess:( Sorry to have bothered you, absolutely not an issue of pocket query but crowd.

Ok, glad to hear it's nothing to do with PocketQuery. Less glad that it's a mess of course ;). If you like PocketQuery after all, would you consider leaving a review at the Atlassian Marketplace? :)

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Aug 22, 2018 in Marketplace Apps

How a Marketplace app tech team is achieving gender diversity

Hello! My name is Genevieve Blanch, and I'm the Marketing Manager at RefinedWiki, creators of apps to give teams the tools to customize Atlassian platforms. Currently, 44% of the tech team at Re...

510 views 3 18
Read article

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