Re: ECPG bug: "unterminated quoted identifier" - Mailing list pgsql-bugs

From Tom Lane
Subject Re: ECPG bug: "unterminated quoted identifier"
Date
Msg-id 674892.1603224610@sss.pgh.pa.us
Whole thread Raw
In response to Re: ECPG bug: "unterminated quoted identifier"  (1250kv <1250kv@gmail.com>)
Responses Re: ECPG bug: "unterminated quoted identifier"  (1250kv <1250kv@gmail.com>)
List pgsql-bugs
1250kv <1250kv@gmail.com> writes:
>   EXEC SQL char *bar = foo;

I think it's pure luck that that doesn't throw an error.
You should not be using the EXEC SQL prefix for something
that isn't a SQL command.

Anyway, the problem you're hitting here is that as soon as you
say EXEC SQL, the syntax rules for quoted strings change.
This is not well documented, and I think it's got some bugs
in itself [1], but "EXEC SQL char *bar = "aaa\"bbb";" is just
wrong.  You can't use C literal syntax inside a SQL code
segment, whether or not the command would work otherwise.

            regards, tom lane

[1] https://www.postgresql.org/message-id/673825.1603223178%40sss.pgh.pa.us



pgsql-bugs by date:

Previous
From: 1250kv
Date:
Subject: Re: ECPG bug: "unterminated quoted identifier"
Next
From: 1250kv
Date:
Subject: Re: ECPG bug: "unterminated quoted identifier"