HMLDude
HMLDude

Reputation: 1637

Meaning of different command line prompts in PostgreSQL?

I have the following code from my command line...

psql (9.1.10)
Type "help" for help.

postgres=# CREATE DATABASE exampledb
postgres-# 

After I entered the CREATE DB command the prompt changed from ending with "=#" to "-#". I would like to know what this change means and what the implications are for receiving and processing commands.

Upvotes: 16

Views: 14716

Answers (1)

HMLDude
HMLDude

Reputation: 1637

I now realize that the "postgres=#" prompt is a fresh prompt waiting for the start of a new command, while the "postgres-#" is the result of hitting enter after typing a command that does not end with a semicolon.

The semicolon denotes the end of a command, so pressing enter without a terminating ";" suggests to postgres that you would like to continue writing your command on a new line.

Inserting a semicolon at any point and pressing enter will return you to the original prompt.

Upvotes: 22

Related Questions