Search code examples
postgresqlpsqlprompt

psql prompt changes to "-#" and the statement isn't committed


I'm new to Postgres and I set up a database and table. On the Ubuntu 18.04 command line (on a cloud server) I issued the following command using psql:

INSERT INTO psq01(date, email, firstname, lastname, password, comments)
   VALUES ("052419", "[email protected]", "John", "Smith", "blank", "No comment")

After I issue that command, the psql command prompt switches from =# to -#, which means the transaction is not finished, so I issued COMMIT, but the prompt still shows as -#.

My question is: what do I do after an insert into command? Why am I getting the -# prompt?


Solution

  • The dbname-# prompt means that psql is waiting for a continuation line because you haven't terminated the statement with a semiculon (;) yet.

    Either type a single semicolon and Enter to finish the command or type Ctrl+C to interrupt it and start over.

    Are you sure that you want to use a superuser for inserting into a table?