Creating Database Querry in psql CLI

Поиск
Список
Период
Сортировка
Искать

Creating Database Querry in psql CLI

От:
PG Doc comments form <noreply@postgresql.org>
Дата:
The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/17/tutorial-createdb.html
Description:

The querry to create database you mentioned in this document  (createdb
db_name)  is not working in my Debian OS , rather create database db_name;
is working

Re: Creating Database Querry in psql CLI

От:
Laurenz Albe <laurenz.albe@cybertec.at>
Дата:
On Wed, 2025-07-16 at 03:57 +0000, PG Doc comments form wrote:
> Page: https://www.postgresql.org/docs/17/tutorial-createdb.html
> 
> The querry to create database you mentioned in this document  (createdb
> db_name)  is not working in my Debian OS , rather create database db_name;
> is working

I *guess* (since you say "querry") that you are already on the "psql"
prompt when you enter "createdb db_name", which won't work, since that
is a shell command.  The $ at the beginning of the line should give
you that clue.

That would also explain why "create database db_name;" works for you,
because that is an SQL statement.

Yours,
Laurenz Albe


Re: Creating Database Querry in psql CLI

От:
"David G. Johnston" <david.g.johnston@gmail.com>
Дата:
On Tuesday, July 15, 2025, PG Doc comments form <noreply@postgresql.org> wrote:
The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/17/tutorial-createdb.html
Description:

The querry to create database you mentioned in this document  (createdb
db_name)  is not working in my Debian OS , rather create database db_name;
is working

As noted here that $ means you need to be at the OS shell to execute createdb.


David J.

FAQ