Postgres driver can't escape :: double colons

Description

Problem: When using a double colon (which is often used in postgesql) query in a queryExecute, Lucee expects a query parameter. I see no way to have double colons AND parameter in a query.

Proposed solution: The possibility to escape characters with a \ characters like other JDBC driver do.

Example (Without parameter, but clear enough to describe the issue):

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, so the query is send to the db as follow:

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

Result:
ERROR: syntax error at or near “:”

So the query fails. Possible solution:

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”});

Environment

None

Activity

Show:

Zac Spitzer 22 November 2021 at 14:10

yep

Pothys - MitrahSoft 22 November 2021 at 11:26

is this duplicated by https://luceeserver.atlassian.net/browse/LDEV-3151 ?

Duplicate

Details

Assignee

Reporter

Priority

New Issue warning screen

Before you create a new Issue, please post to the mailing list first https://dev.lucee.org

Once the issue has been verified, one of the Lucee team will ask you to file an issue

Created 20 November 2021 at 14:42
Updated 22 November 2021 at 14:10
Resolved 22 November 2021 at 14:10

Flag notifications