[bug fix] ECPG: fails to recognize embedded parameters

From: "Tsunakawa, Takayuki" <tsunakawa(dot)takay(at)jp(dot)fujitsu(dot)com>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: [bug fix] ECPG: fails to recognize embedded parameters
Date: 2017-10-23 08:01:04
Message-ID: 0A3221C70F24FB45833433255569204D1F80AB63@G01JPEXMBYT05
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello,

This is an actual problem that our customer hit. In ECPG, opening a cursor fails which is declared as follows:

EXEC SQL DECLARE cur CURSOR FOR
SELECT oid, datname
FROM pg_database
WHERE datname LIKE 'post%' ESCAPE '\' AND datconnlimit = :connlimit;

sqlstate: 07001
sqlerrm.sqlerrmc: too many arguments on line 30

The cause is that next_insert() in ecpglib unconditionally skips the next character after the backslash.

Could you review and commit the attached patch? I also attached the test program for convenience.

Regards
Takayuki Tsunakawa

Attachment Content-Type Size
ecpg_escape_string.patch application/octet-stream 2.0 KB
escape.ec application/octet-stream 873 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrey Borodin 2017-10-23 08:13:56 Re: Allow GiST opcalsses without compress\decompres functions
Previous Message Amit Langote 2017-10-23 07:42:44 Re: path toward faster partition pruning