ESQL CREATE DATABASE - Mailing list pgsql-sql

From Krejci, Pavel
Subject ESQL CREATE DATABASE
Date
Msg-id 3E4278088AD82C48B4663DDFE762CEF304F30FA1@prga004a.ww300.siemens.net
Whole thread Raw
List 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

pgsql-sql by date:

Previous
From: "Marcin Krawczyk"
Date:
Subject: Re: record type
Next
From: "samantha mahindrakar"
Date:
Subject: Rollback in Postgres