RE: SQL statement PREPARE does not work in ECPG

From: "Matsumura, Ryo" <matsumura(dot)ryo(at)jp(dot)fujitsu(dot)com>
To: 'Michael Meskes' <meskes(at)postgresql(dot)org>, "Takahashi, Ryohei" <r(dot)takahashi_2(at)jp(dot)fujitsu(dot)com>, "'pgsql-hackers(at)postgresql(dot)org'" <pgsql-hackers(at)postgresql(dot)org>
Cc: "Ideriha, Takeshi" <ideriha(dot)takeshi(at)jp(dot)fujitsu(dot)com>, "Kuroda, Hayato" <kuroda(dot)hayato(at)jp(dot)fujitsu(dot)com>
Subject: RE: SQL statement PREPARE does not work in ECPG
Date: 2019-03-18 07:31:51
Message-ID: 03040DFF97E6E54E88D3BFEE5F5480F737AD6C13@G01JPEXMBYT04
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


Thank you for your comment.

> One question though, why is the statement name always quoted? Do we
> really need that? Seems to be more of a hassle than and advantage.

The following can be accepted by preproc, ecpglib, libpq, and backend in previous versions.
exec sql prepare "st x" from "select 1";
exec sql execute "st x";

The above was preprocessed to the following.
PQprepare(conn, "\"st x\"", "select 1");
PQexec(conn, "\"st x\"");

By the way, the following also can be accepted.
PQexecParams(conn, "prepare \"st x\" ( int ) as select $1", 0, NULL, NULL, NULL, NULL, 0);
PQexecParams(conn, "execute \"st x\"( 1 )", 0, NULL, NULL, NULL, NULL, 0);

Therefore, I think that the quoting statement name is needed in PREPARE/EXECUTE case, too.

> I would prefer to merge as much as possible, as I am afraid that if we
> do not merge the approaches, we will run into issues later. There was a
> reason why we added PQprepare, but I do not remember it from the top of
> my head. Need to check when I'm online again.

I will also consider it.

Ryo Matsumura

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2019-03-18 07:32:44 Re: pg_basebackup ignores the existing data directory permissions
Previous Message Michael Banck 2019-03-18 07:18:18 Re: Online verification of checksums