ESQL CREATE DATABASE

From: "Krejci, Pavel" <pavel(dot)krejci(at)siemens(dot)com>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: ESQL CREATE DATABASE
Date: 2008-07-11 12:08:16
Message-ID: 3E4278088AD82C48B4663DDFE762CEF304F30FA1@prga004a.ww300.siemens.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hello,

I am using embedded SQL command for creating the database:

EXEC SQL BEGIN DECLARE SECTION;
char dbase[32];
EXEC SQL END DECLARE SECTION;
...

EXEC SQL CONNECT TO postgres;
//the create database cannot be run in transaction block
EXEC SQL SET AUTOCOMMIT TO ON;

EXEC SQL CREATE DATABASE :dbase;

I get an error during compile with ecpg (/usr/bin/ecpg -I../../include
-c source_file.ec)
ERROR: syntax error at or near ":dbase"
*** Error code 3

When I use literal string like: "EXEC SQL CREATE DATABASE my_dbase;" it
is compilable and it works.

All other SQL commands work with the variables except for the CREATE
DATABASE.

I am using the package postgresql-devel-8.1.3-12.


Any idea?

Thank you!

Pavel Krejci

Browse pgsql-sql by date

  From Date Subject
Next Message samantha mahindrakar 2008-07-11 15:43:13 Rollback in Postgres
Previous Message Marcin Krawczyk 2008-07-11 09:54:25 Re: record type