Hi All,

I thought that I could quickly create a new and empty database using psql but
I obviously have the syntax messed up. I have already worked around the issue
by using pgadmin but I would appreciate your time if you could explain the
correct way to accomplish this with psql. TIA

# psql --username postgres --echo-all --command "CREATE DATABASE NEW_DB WITH
ENCODING = 'SQL_ASCII';"
psql: FATAL: Database "postgres" does not exist in the system catalog.

# psql --dbname template1 --username postgres --echo-all --command "CREATE
DATABASE NEW_DB WITH ENCODING = 'SQL_ASCII';"
CREATE DATABASE NEW_DB WITH ENCODING = 'SQL_ASCII';
ERROR: CREATE DATABASE: source database "template1" is being accessed by
other users

Kind Regards,
Keith

______________________________________________
99main Internet Services http://www.99main.com

Search Discussions

  • John DeSoi at Jan 14, 2005 at 6:32 pm

    On Jan 14, 2005, at 12:42 PM, Keith Worthington wrote:

    I thought that I could quickly create a new and empty database using
    psql but
    I obviously have the syntax messed up. I have already worked around
    the issue
    by using pgadmin but I would appreciate your time if you could explain
    the
    correct way to accomplish this with psql. TIA
    The best way to accomplish this from the command line is to use
    createdb instead of psql.

    http://www.postgresql.org/docs/7.4/static/app-createdb.html


    John DeSoi, Ph.D.
    http://pgedit.com/
    Power Tools for PostgreSQL
  • Robert Köpferl at Jan 17, 2005 at 10:47 am
    your problem is that you're missing a 'start'-database. Thus you should log
    into temlate1-db where you are then able to submit your CREATE DB
    -----Original Message-----
    From: Keith Worthington
    Sent: Freitag, 14. Jänner 2005 18:43
    To: PostgreSQL Novice
    Subject: [NOVICE] N/A


    Hi All,

    I thought that I could quickly create a new and empty
    database using psql but
    I obviously have the syntax messed up. I have already worked
    around the issue
    by using pgadmin but I would appreciate your time if you
    could explain the
    correct way to accomplish this with psql. TIA

    # psql --username postgres --echo-all --command "CREATE
    DATABASE NEW_DB WITH
    ENCODING = 'SQL_ASCII';"
    psql: FATAL: Database "postgres" does not exist in the
    system catalog.

    # psql --dbname template1 --username postgres --echo-all
    --command "CREATE
    DATABASE NEW_DB WITH ENCODING = 'SQL_ASCII';"
    CREATE DATABASE NEW_DB WITH ENCODING = 'SQL_ASCII';
    ERROR: CREATE DATABASE: source database "template1" is being
    accessed by
    other users

    Kind Regards,
    Keith

    ______________________________________________
    99main Internet Services http://www.99main.com


    ---------------------------(end of
    broadcast)---------------------------
    TIP 8: explain analyze is your friend

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppgsql-novice @
categoriespostgresql
postedJan 14, '05 at 5:43p
activeJan 17, '05 at 10:47a
posts3
users3
websitepostgresql.org
irc#postgresql

People

Translate

site design / logo © 2022 Grokbase