Re: [Bug Fix] ECPG: could not use some CREATE TABLE AS syntax - Mailing list pgsql-hackers

From Michael Meskes
Subject Re: [Bug Fix] ECPG: could not use some CREATE TABLE AS syntax
Date
Msg-id ad45d787696f630b9efef02d4b7136c7721c72ee.camel@postgresql.org
Whole thread Raw
In response to [Bug Fix] ECPG: could not use some CREATE TABLE AS syntax  ("Higuchi, Daisuke" <higuchi.daisuke@jp.fujitsu.com>)
Responses RE: [Bug Fix] ECPG: could not use some CREATE TABLE AS syntax
List pgsql-hackers
Higuchi-san,

> I found some "CREATE TABLE ... AS ... " syntaxes could not be used in
> ECPG. 
> ...
> [Investigation]
> In my investigation, parse.pl ignore type CreateAsStmt of gram.y and
> CreateAsStmt is defined in ecpg.trailer. ECPG use ecpg.trailer's
> CreateAsStmt. However, ecpg.trailer lacks some syntaxes. 

Correct, the syntax of create as statement was changed and those
changes have not been added to ecpg.

> I feel ignoring type CreateAsStmt of gram.y is strange. Seeing
> ecpg.trailer, it seems that ECPG wanted to output the message "CREATE
> TABLE AS cannot specify INTO" but is this needed now? In view of the
> maintenance, ECPG should use not ecpg.trailer's definition but
> gram.y's one. 

I beg to disagree, or I don't understand. Why would ecpg's changes to
the statement be wrong nowadays?

> I attached the patch for this and I will register this for next CF. 

I think the patch does not work correctly. The statement
CREATE TABLE a AS SELECT * INTO test FROM a;
is accepted with your patch, but it is not accepted in current ecpg nor
is it accepted by the backend when you execute it through ecpg. The
whole change of this rule has been made to make sure this syntax is not
accepted.

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 by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Reporting script runtimes in pg_regress
Next
From: Stephen Frost
Date:
Subject: Re: WAL insert delay settings