Thread: [HACKERS] [bug fix] ECPG: fails to recognize embedded parameters

[HACKERS] [bug fix] ECPG: fails to recognize embedded parameters

From
"Tsunakawa, Takayuki"
Date:
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



-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Attachment

Re: [HACKERS] [bug fix] ECPG: fails to recognize embedded parameters

From
Michael Meskes
Date:
> 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.

Thanks for spotting and fixing. I just committed your patch to master
and backported to 9.4, 9.5, 9.6 and 10. It doesn't apply cleanly to
9.3. But then it might not be important enough to investigate and
backported to this old a version.

Michael
--
Michael Meskes
Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
Meskes at (Debian|Postgresql) dot Org
Jabber: michael at xmpp dot meskes dot org
VfL Borussia! Força Barça! SF 49ers! Use Debian GNU/Linux, PostgreSQL


--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Re: [HACKERS] [bug fix] ECPG: fails to recognize embedded parameters

From
"Tsunakawa, Takayuki"
Date:
From: pgsql-hackers-owner@postgresql.org
> [mailto:pgsql-hackers-owner@postgresql.org] On Behalf Of Michael Meskes
> Thanks for spotting and fixing. I just committed your patch to master and
> backported to 9.4, 9.5, 9.6 and 10. It doesn't apply cleanly to 9.3. But
> then it might not be important enough to investigate and backported to this
> old a version.

Thanks.  I'm OK with 9.3.

Regards
Takayuki Tsunakawa


--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers