pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedStarting psql without a database?
5+ messages / 3 participants
[nested] [flat]
* Starting psql without a database?
@ 2011-04-27 18:44 Fred Parkinson <FredP@abag.ca.gov>
0 siblings, 1 reply; 5+ messages in thread
From: Fred Parkinson @ 2011-04-27 18:44 UTC (permalink / raw)
To: pgsql-admin
Folks
As I have been unable to install pgadmin3 on my OpenSUSE Linux 10 box (erroneously described as 11.2 in the request for help post, that was useless), I have decided to use psql since it seems to be my only option.
However, I have no database as yet, and when I type in a console 'psql' I get the message "psql: FATAL: database 'username' does not exist"
So I try to start by sending the createdb command, as in: "psql -c createdb -T DEFAULT 'timecard'" but this returns the error "psql: FATAL: database "timecard" does not exist"
I tried using the database 'postgres' which seems to be created during the install:
psql postgres, which takes me to a psql prompt. However, the command createdb -T DEFAULT "timecard" now results in the error "syntax error at or neat "createdb" with a carat pointing to the 'c' in 'createdb'.
As usual, stuck again!
Any ideas greatly appreciated.
Fred
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Starting psql without a database?
@ 2011-04-27 18:51 Kevin Grittner <Kevin.Grittner@wicourts.gov>
parent: Fred Parkinson <FredP@abag.ca.gov>
0 siblings, 1 reply; 5+ messages in thread
From: Kevin Grittner @ 2011-04-27 18:51 UTC (permalink / raw)
To: Fred Parkinson <FredP@abag.ca.gov>; pgsql-admin
"Fred Parkinson" <FredP@abag.ca.gov> wrote:
> I tried using the database 'postgres' which seems to be created
> during the install:
> psql postgres, which takes me to a psql prompt. However, the
> command createdb -T DEFAULT "timecard" now results in the error
> "syntax error at or neat "createdb" with a carat pointing to the
> 'c' in 'createdb'.
I think you're confusing the OS command-line executable createdb:
http://www.postgresql.org/docs/9.0/interactive/app-createdb.html
and the SQL command CREATE DATABASE:
http://www.postgresql.org/docs/9.0/interactive/sql-createdatabase.html
-Kevin
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Starting psql without a database?
@ 2011-04-27 19:44 Fred Parkinson <FredP@abag.ca.gov>
parent: Kevin Grittner <Kevin.Grittner@wicourts.gov>
0 siblings, 2 replies; 5+ messages in thread
From: Fred Parkinson @ 2011-04-27 19:44 UTC (permalink / raw)
To: pgsql-admin; Kevin Grittner <Kevin.Grittner@wicourts.gov>
Right you are! 'CREATE DATABASE' worked (started psql with the postgres database) where createdb didn't.
Was there some way to tell from the documentation that createdb is to run from the shell while CREATE DATABASE is run from the psql prompt? I assumed all database-related commands are run from the psql prompt.
Thanks again, Fred
>>> "Kevin Grittner" <Kevin.Grittner@wicourts.gov> 04/27/2011 11:51 AM >>>
"Fred Parkinson" <FredP@abag.ca.gov> wrote:
> I tried using the database 'postgres' which seems to be created
> during the install:
> psql postgres, which takes me to a psql prompt. However, the
> command createdb -T DEFAULT "timecard" now results in the error
> "syntax error at or neat "createdb" with a carat pointing to the
> 'c' in 'createdb'.
I think you're confusing the OS command-line executable createdb:
http://www.postgresql.org/docs/9.0/interactive/app-createdb.html
and the SQL command CREATE DATABASE:
http://www.postgresql.org/docs/9.0/interactive/sql-createdatabase.html
-Kevin
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Starting psql without a database?
@ 2011-04-27 20:05 Kevin Grittner <Kevin.Grittner@wicourts.gov>
parent: Fred Parkinson <FredP@abag.ca.gov>
1 sibling, 0 replies; 5+ messages in thread
From: Kevin Grittner @ 2011-04-27 20:05 UTC (permalink / raw)
To: Fred Parkinson <FredP@abag.ca.gov>; pgsql-admin
"Fred Parkinson" <FredP@abag.ca.gov> wrote:
> Was there some way to tell from the documentation that createdb is
> to run from the shell while CREATE DATABASE is run from the psql
> prompt?
One is in the "PostgreSQL Client Applications" section, along with
psql and pg_dump. The other is in the "SQL Commands" section.
Applications run in the OS shell, while SQL commands run in a
database session.
-Kevin
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Starting psql without a database?
@ 2011-04-27 20:15 Tom Lane <tgl@sss.pgh.pa.us>
parent: Fred Parkinson <FredP@abag.ca.gov>
1 sibling, 0 replies; 5+ messages in thread
From: Tom Lane @ 2011-04-27 20:15 UTC (permalink / raw)
To: Fred Parkinson <FredP@abag.ca.gov>; +Cc: pgsql-admin@postgresql.org, "Kevin Grittner" <Kevin.Grittner@wicourts.gov>
"Fred Parkinson" <FredP@abag.ca.gov> writes:
> Was there some way to tell from the documentation that createdb is to run from the shell while CREATE DATABASE is run from the psql prompt?
The reference section of the manual documents the former under "Client
Applications" and the latter under "SQL Commands".
regards, tom lane
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2011-04-27 20:15 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-04-27 18:44 Starting psql without a database? Fred Parkinson <FredP@abag.ca.gov>
2011-04-27 18:51 ` Kevin Grittner <Kevin.Grittner@wicourts.gov>
2011-04-27 19:44 ` Fred Parkinson <FredP@abag.ca.gov>
2011-04-27 20:05 ` Kevin Grittner <Kevin.Grittner@wicourts.gov>
2011-04-27 20:15 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox