My question: i’ll try to execute a sql query on psg with a double colon in the statement:
qGetJourneyDisplay = queryExecute("
SELECT journey_title, journey_id FROM baba.journey JOIN unnest('{5,3,1,2,4}'::int[ ]) WITH ORDINALITY AS x(journey_id, order_nr) USING (journey_id) ORDER BY x.order_nr
",{},{returntype="query"});
Lucce has a problem with a double colon in the quety and eats one : away,
SELECT journey_title, journey_id FROM babawanga.journey JOIN unnest('{5,3,1,2,4}':int[]) WITH ORDINALITY AS x(journey_id, order_nr) USING (journey_id) ORDER BY x.order_nr
ERROR: syntax error at or near ":"
So the query fails. What is the correct way to encode the :: in ?
Thx
PS : Also this forum software has encoding issues… the tick box should be squared brackets
PS2: queryExecute expects a param after a colon. There must be a way to encode that colons, right?
hi @baba
Already has a ticket for this issue in Jira LDEV-1063
Workaround for your issue, If you didn’t use any params means you can use named argument in queryExecute()
qGetJourneyDisplay = queryExecute(
sql="SELECT journey_title, journey_id FROM baba.journey JOIN unnest(’{5,3,1,2,4}’::int) WITH ORDINALITY AS x(journey_id, order_nr) USING (journey_id) ORDER BY x.order_nr.......",
options={returntype=“query”}
);
Or use the query tag-script method
query name="qGetJourneyDisplay" returntype="query" {
echo("SELECT journey_title, journey_id FROM baba.journey JOIN unnest(’{5,3,1,2,4}’::int) WITH ORDINALITY AS x(journey_id, order_nr) USING (journey_id) ORDER BY x.order_nr.........");
}