Re: SQL statement PREPARE does not work in ECPG

From: Michael Meskes <meskes(at)postgresql(dot)org>
To: "Takahashi, Ryohei" <r(dot)takahashi_2(at)jp(dot)fujitsu(dot)com>, "Matsumura, Ryo" <matsumura(dot)ryo(at)jp(dot)fujitsu(dot)com>, "'pgsql-hackers(at)postgresql(dot)org'" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: SQL statement PREPARE does not work in ECPG
Date: 2019-02-21 09:02:40
Message-ID: f359c5f5247298b5a79f791198f43264a9729c3f.camel@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Takahashi-san,

> It works well for my statement
>
> "EXEC SQL PREPARE test_prep (int) AS SELECT id from test_table where
> id = $1;".
>
> However, since data type information is not used, it does not works
> well
> for prepare statements which need data type information such as
> "EXEC SQL PREPARE test_prep (int, int) AS SELECT $1 + $2;".

Yes, that was to be expected. This is what Matsumura-san was trying to
fix. However, I'm not sure yet which of his ideas is the best.

> It also works.
> (Actually, I wrote "EXEC SQL EXECUTE test_prep (:i) INTO :ID;".)

Ok, thanks. That means the parser has to handle the list of execute
arguments differently, which in hindsight is pretty obvious.

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Ants Aasma 2019-02-21 09:06:44 Re: WAL insert delay settings
Previous Message mitani 2019-02-21 08:44:00 [PATCH] Allow transaction to partition table using FDW