Lists: | pgsql-general |
---|
From: | Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | error code with psql |
Date: | 2004-05-06 01:51:39 |
Message-ID: | 20040506.105139.85416256.t-ishii@sra.co.jp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
Hi,
Does anybody know how I can get error codes using psql? I know that I
could get error codes from server log or using libpq function. I just
could not figure out a way to display them in psql.
--
Tatsuo Ishii
From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: error code with psql |
Date: | 2004-05-06 02:59:11 |
Message-ID: | 21172.1083812351@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp> writes:
> Does anybody know how I can get error codes using psql? I know that I
> could get error codes from server log or using libpq function. I just
> could not figure out a way to display them in psql.
"\set VERBOSITY verbose". Might be more than you want though...
regards, tom lane
From: | Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp> |
---|---|
To: | tgl(at)sss(dot)pgh(dot)pa(dot)us |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: error code with psql |
Date: | 2004-05-06 03:08:01 |
Message-ID: | 20040506.120801.126760220.t-ishii@sra.co.jp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
> Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp> writes:
> > Does anybody know how I can get error codes using psql? I know that I
> > could get error codes from server log or using libpq function. I just
> > could not figure out a way to display them in psql.
>
> "\set VERBOSITY verbose". Might be more than you want though...
Oh, thanks.
--
Tatsuo Ishii
From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: error code with psql |
Date: | 2004-05-06 03:13:15 |
Message-ID: | 200405060313.i463DFx14672@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
Tatsuo Ishii wrote:
> Hi,
>
> Does anybody know how I can get error codes using psql? I know that I
> could get error codes from server log or using libpq function. I just
> could not figure out a way to display them in psql.
Sure. With psql, you need to set the VERBOSITY setting for psql to
access those error codes:
test=> CREATE TABLE test (x int UNIQUE);
NOTICE: CREATE TABLE / UNIQUE will create implicit index "test_x_key"
for table "test"
CREATE TABLE
test=> INSERT INTO test VALUES (1);
INSERT 17225 1
test=> INSERT INTO test VALUES (1);
ERROR: duplicate key violates unique constraint "test_x_key"
test=> \set VERBOSITY 'verbose'
test=> INSERT INTO test VALUES (1);
--> ERROR: 23505: duplicate key violates unique constraint "test_x_key"
LOCATION: _bt_check_unique, nbtinsert.c:255
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073