Bug: ECPG: Cannot use CREATE AS EXECUTE statemnt

From: "Matsumura, Ryo" <matsumura(dot)ryo(at)jp(dot)fujitsu(dot)com>
To: "'pgsql-hackers(at)postgresql(dot)org'" <pgsql-hackers(at)postgresql(dot)org>
Subject: Bug: ECPG: Cannot use CREATE AS EXECUTE statemnt
Date: 2019-06-06 07:38:34
Message-ID: 03040DFF97E6E54E88D3BFEE5F5480F74ABEF804@G01JPEXMBYT04
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Meskes-san

This thread is branched from the following.
https://www.postgresql.org/message-id/03040DFF97E6E54E88D3BFEE5F5480F74ABEADE7@G01JPEXMBYT04

> > Type1. Bugs or intentional unsupported features.
> > - EXPLAIN EXECUTE
> > - **CREATE TABLE AS with using clause**

I noticed that CREATE AS EXECUTE with using clause needs a new
implementation that all parameters in using clause must be embedded into
expr-list of EXECUTE in text-format as the following because there is
no interface of protocol for our purpose.
It spends more time for implementing. Do you have any advice?

int id = 100;
EXEC SQL CREATE TABLE test AS EXECUTE stmt using :id;
-->
PQexec("CREATE TABLE test AS EXECUTE stmt(100)");

e.g. PQexecParamas("CREATE TABLE test AS EXECUTE stmt", {23,0},{"100",0},{3,0},NULL)
It sends the following.

To backend> Msg P
To backend> ""
To backend> "create table test as execute stmt"
:
To backend> Msg B
To backend> ""
To backend> "" ---> It means execute request "create table test as execute stmt" with the value.
To backend (2#)> 1 But the create statement has no $x. Since the value may be discard.
To backend (2#)> 0 In result, the following error is occurred.
To backend (2#)> 1
To backend (4#)> 3
To backend> 100
To backend (2#)> 1
To backend (2#)> 0
:
2019-06-06 07:26:35.252 UTC [1630] ERROR: wrong number of parameters for prepared statement "stmt"
2019-06-06 07:26:35.252 UTC [1630] DETAIL: Expected 1 parameters but got 0.
2019-06-06 07:26:35.252 UTC [1630] STATEMENT: create table test2 as execute stmt

Regards
Ryo Matsumura

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kato, Sho 2019-06-06 07:47:07 RE: Why does not subquery pruning conditions inherit to parent query?
Previous Message Michael Paquier 2019-06-06 07:31:43 Re: crash testing suggestions for 12 beta 1