Hi,
I found some "CREATE TABLE ... AS ... " syntaxes could not be used in ECPG.
[PROBLEM]
First, ECPG command is failed when the source code (*.pgc) has "IF NOT EXISTS".
-------------------------------------------------------------------
EXEC SQL CREATE TABLE IF NOT EXISTS test_cta AS SELECT * FROM test;
-------------------------------------------------------------------
Second, ECPG command is succeeded when the source code (*.pgc) has following embedded SQL. However, created c program
hasno "WITH NO DATA".
------------------------------------------------------------------
EXEC SQL CREATE TABLE test_cta AS SELECT * FROM test WITH NO DATA;
------------------------------------------------------------------
[Investigation]
In my investigation, parse.pl ignore type CreateAsStmt of gram.y and CreateAsStmt is defined in ecpg.trailer. ECPG use
ecpg.trailer'sCreateAsStmt. However, ecpg.trailer lacks some syntaxes.
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'sdefinition but gram.y's one.
I attached the patch for this and I will register this for next CF.
Regards,
Daisuke Higuchi