Late to the party, but the accepted answer doesn't explain why no error is displayed. And as this is something Postgres newcomers often stumble upon, I wanted to add that.
TL/TR: always end your SQL statements with ;
Because the createdb database
did not end with ;
psql
thinks the statement isn't finished and waits for more input. This is indicated by the prompt changing from postgres=#
to postgres-#
. An extremely subtle change that I wish psql
would do differently (more "prominent").
By entering the meta-command \list
the "current" SQL statement is "aborted" without executing it.
If the createdb
had been ended with a ;
the output would have been:
postgres=> createdb foobar;
ERROR: syntax error at or near "createdb"
LINE 1: createdb foobar;
^
postgres=>
Clearly showing that something was wrong.