Thread: ECPG: "EXEC SQL CREATE SCHEMA foo" Broken

ECPG: "EXEC SQL CREATE SCHEMA foo" Broken

From
Lee Kindness
Date:
Hi, please apply patch below to correct the EXEC SQL CREATE SCHEMA
construct in ECPG. Currently (versions 7.3.x, 7.4) the preprocessor
emmits "create scheme" in error, rather than "create schema".

A workaround also exists for those who require it (but I guess no-one
apart from me does since it's went unreported through 7.3), rather
than (checking omitted):

 EXEC SQL CREATE SCHEMA foo;

you can use:

 EXEC SQL BEGIN DECLARE SECTION;
 char l_cmd[50];
 EXEC SQL END DECLARE SECTION;

 snprintf(l_cmd, sizeof(l_cmd), "CREATE SCHEMA foo");
 EXEC SQL EXECUTE IMMEDIATE :l_cmd;

Thanks, L.

*** src/interfaces/ecpg/preproc/preproc.y.orig    2003-11-19 10:52:25.000000000 +0000
--- src/interfaces/ecpg/preproc/preproc.y    2003-11-19 10:52:30.000000000 +0000
***************
*** 966,974 ****
   *****************************************************************************/

  CreateSchemaStmt:  CREATE SCHEMA UserId OptSchemaName AUTHORIZATION UserId OptSchemaEltList
!             { $$ = cat_str(6, make_str("create scheme"), $3, $4, make_str("authorization"), $6, $7); }
          | CREATE SCHEMA ColId OptSchemaEltList
!             { $$ = cat_str(3, make_str("create scheme"), $3, $4); }
          ;

  OptSchemaName: ColId        { $$ = $1; }
--- 966,974 ----
   *****************************************************************************/

  CreateSchemaStmt:  CREATE SCHEMA UserId OptSchemaName AUTHORIZATION UserId OptSchemaEltList
!             { $$ = cat_str(6, make_str("create schema"), $3, $4, make_str("authorization"), $6, $7); }
          | CREATE SCHEMA ColId OptSchemaEltList
!             { $$ = cat_str(3, make_str("create schema"), $3, $4); }
          ;

  OptSchemaName: ColId        { $$ = $1; }

Re: ECPG: "EXEC SQL CREATE SCHEMA foo" Broken

From
Michael Meskes
Date:
On Wed, Nov 19, 2003 at 11:02:59AM +0000, Lee Kindness wrote:
> Hi, please apply patch below to correct the EXEC SQL CREATE SCHEMA
> construct in ECPG. Currently (versions 7.3.x, 7.4) the preprocessor
> emmits "create scheme" in error, rather than "create schema".

Thanks. Applied to HEAD and 7.4. I take it it will make it into 7.4.1
this way.

Michael
-- 
Michael Meskes
Email: Michael at Fam-Meskes dot De
ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: meskes@jabber.org
Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!


Re: ECPG: "EXEC SQL CREATE SCHEMA foo" Broken

From
Bruce Momjian
Date:
Michael Meskes wrote:
> On Wed, Nov 19, 2003 at 11:02:59AM +0000, Lee Kindness wrote:
> > Hi, please apply patch below to correct the EXEC SQL CREATE SCHEMA
> > construct in ECPG. Currently (versions 7.3.x, 7.4) the preprocessor
> > emmits "create scheme" in error, rather than "create schema".
> 
> Thanks. Applied to HEAD and 7.4. I take it it will make it into 7.4.1
> this way.

Yes.

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073