Home > Back-end >  Postgres Issue: prompt has changed
Postgres Issue: prompt has changed

Time:02-14

test=# SELECT COUNT(id) FROM person'

test'#

enter image description here

CodePudding user response:

psql is smart enough to guide us. Look at this simple session:

postgres=# select
postgres-# (          -- statement was not finished by semicolon
postgres(# select     -- parenthesis was opened, needs to be closed
postgres(# '
postgres'# abc        -- quote was opened, needs to be closed
postgres'# '          -- quote is still opened
postgres(# as x       -- quote was closed, parenthesis still opened
postgres(# )
postgres-# ;          -- parenthesis was closed, statement needs semicolon to completion
┌─────┐
│  x  │
├─────┤
│    ↵│
│ abc↵│
│     │
└─────┘
  • Related