Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all articles
Browse latest Browse all 13329

New to PostgreSQL couple of questions

$
0
0
I am trying to write a script for the full creation of a database and all of its objects, similar to the following:

Code:

CREATE DATABASE DBName;

\connect DBName;

CREATE TABLE TableOne
(
    id BIGSERIAL NOT NULL PRIMARY KEY
    , RowDesc VARCHAR(50)
);

I'm running into a problem in that there doesn't appear to be a way to change the database connection mid-script. Do I just need to append the newly-created database name to all following CREATE TABLE commands (e.g. CREATE TABLE DBName.TableOne...)?

Secondly, is there a way to maintain the capitalization used in the table name in the CREATE TABLE command? If I execute CREATE TABLE TableOne, I get a table created named tableone.

Thanks.

Viewing all articles
Browse latest Browse all 13329

Trending Articles