pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: 1250kv <1250kv@gmail.com>
Cc: PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Subject: Re: ECPG bug: "unterminated quoted identifier"
Date: Tue, 20 Oct 2020 16:10:10 -0400
Message-ID: <674892.1603224610@sss.pgh.pa.us> (raw)
In-Reply-To: <CA+4qtLd4K09yFA3S5ktaDDr0VQAVuXQpzvhbFufhGOisny+d7w@mail.gmail.com>
References: <CA+4qtLct1L=gUordX4c_AdctJ+vZBsebYYLBk18LX8dLHthktg@mail.gmail.com>
	<652858.1603214598@sss.pgh.pa.us>
	<CA+4qtLd4K09yFA3S5ktaDDr0VQAVuXQpzvhbFufhGOisny+d7w@mail.gmail.com>

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





view thread (9+ messages)  latest in thread

Message-ID: <674892.1603224610@sss.pgh.pa.us>
Permalink:  ../674892.1603224610@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/674892.1603224610@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, 1250kv@gmail.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: ECPG bug: "unterminated quoted identifier"
  In-Reply-To: <674892.1603224610@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox