RE: SQL statement PREPARE does not work in ECPG

From: "Matsumura, Ryo" <matsumura(dot)ryo(at)jp(dot)fujitsu(dot)com>
To: "Matsumura, Ryo" <matsumura(dot)ryo(at)jp(dot)fujitsu(dot)com>, '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>
Subject: RE: SQL statement PREPARE does not work in ECPG
Date: 2019-02-22 09:59:26
Message-ID: 03040DFF97E6E54E88D3BFEE5F5480F737AA90C2@G01JPEXMBYT04
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Meskes-san

I made mistake.

> The checking (line-1495) is meaningless for AS clause.
> It checks if all $0 is replaced to literal and all ? is replaced to $[0-9]* by insert_tobeinserted(),
> but it always fails because $[0-9]* in AS clause are not replaced (and should not be replaced).
> I don't search if there is other similar case. It is Idea-2.

It checks if a number of variables equals a number of $* after replacing $0 and ?.
It always fails because there is no variable for $* in AS clause.
We should skip AS clause at the cheking.

Umm... The skipping seems to be not easy too.

next_insert(char *text, int pos, bool questionmarks, bool std_strings)
{
pos = get_pos_of_as_clause(text); <-- parse text in ecpglib???
for (; text[p] != '\0'; p++)
if(is_prepare_statement(stmt) && invalid_pos(pos))
break;

Regards
Ryo Matsumura

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ants Aasma 2019-02-22 10:22:43 Re: CPU costs of random_zipfian in pgbench
Previous Message Julien Rouhaud 2019-02-22 09:24:32 Re: reloption to prevent VACUUM from truncating empty pages at the end of relation