Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get error codes while using psql

When I run an SQL script using psql.exe I am not getting error codes when an error occurs. Is there any way to get the psql error codes?

I tried setting VERBOSITY to 'verbose' like this, but no use:

\set VERBOSITY 'verbose'

I am using psql of version psql (PostgreSQL) 8.4.2.

like image 333
vchitta Avatar asked Jun 24 '11 08:06

vchitta


People also ask

What does $$ mean in PostgreSQL?

A dollar sign ($) followed by digits is used to represent a positional parameter in the body of a function definition or a prepared statement. In other contexts the dollar sign may be part of an identifier or a dollar-quoted string constant.

What is Createdb in PostgreSQL?

createdb creates a new PostgreSQL database. Normally, the database user who executes this command becomes the owner of the new database. However, a different owner can be specified via the -O option, if the executing user has appropriate privileges. createdb is a wrapper around the SQL command CREATE DATABASE .


1 Answers

Get rid of the quotes:

test=# \set VERBOSITY verbose
test=# select broken;
ERROR:  42703: column "broken" does not exist
LINE 1: select broken;
               ^
LOCATION:  transformColumnRef, parse_expr.c:766
like image 194
Denis de Bernardy Avatar answered Sep 27 '22 16:09

Denis de Bernardy