test=# SELECT COUNT(id) FROM person’
test’#
Advertisement
Answer
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↵│ │ │ └─────┘
The whole statement looks like
select (select 'abc' as x);
without n
‘s