Re: SQL statement PREPARE does not work in ECPG

Поиск
Список
Период
Сортировка
От Michael Meskes
Тема Re: SQL statement PREPARE does not work in ECPG
Дата
Msg-id bee73c1010ff6ffada9285c34cd2dc1a6bcd124c.camel@postgresql.org
обсуждение исходный текст
Ответ на RE: SQL statement PREPARE does not work in ECPG  ("Takahashi, Ryohei" <r.takahashi_2@jp.fujitsu.com>)
Ответы RE: SQL statement PREPARE does not work in ECPG  ("Matsumura, Ryo" <matsumura.ryo@jp.fujitsu.com>)
Список pgsql-hackers
Hi Takahashi-san

> In the case of standard types, ECPG can get oids from pg_type.h.
> However, in the case of user defined types, ECPG needs to access
> pg_type table and it is overhead.

The overhead wouldn't be too bad. In fact it's already done, at least
sometimes. Please check ecpg_is_type_an_array().

> By the way, should we support prepare statement like following?
> (I think yes.)

If the standard allows it, we want to be able to process it.

> ============================
> EXEC SQL PREPARE test_prep (int) AS SELECT id from test_table where
> id = :ID or id =$1;
> ============================
> 
> Current ECPG produces following code.
> 
> ============================
> ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "prepare \"test_prep\"
> ( int ) as \" select id from test_table where id = $1  or id = $1
> \"",
>         ECPGt_int,&(ID),(long)1,(long)1,sizeof(int),
>         ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
> ECPGt_EORT);
> ============================
> 
> 
> In this case, both ":ID" and "$1" in the original statement are
> converted to "$1" and ECPGdo() cannot distinguish them.
> Therefore, ECPG should produce different code.

I agree. It seems that stuff really broke over the years and nobody
noticed, sigh.

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



В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Nagaura, Ryohei"
Дата:
Сообщение: RE: Timeout parameters
Следующее
От: Amit Kapila
Дата:
Сообщение: Re: pgsql: Avoid creation of the free space map for small heaprelations, t