Re: Error Codes? - Mailing list pgsql-general

From Martijn van Oosterhout
Subject Re: Error Codes?
Date
Msg-id 20011011110501.A21264@svana.org
Whole thread Raw
In response to Re: Error Codes?  (Fran Fabrizio <ffabrizio@mmrd.com>)
List pgsql-general
On Wed, Oct 10, 2001 at 05:41:37PM -0400, Fran Fabrizio wrote:
> > Rob Arnold wrote:
> >
> > > Look at $db->errstr  That has the text version of the error code.
> > >
> > > --rob
>
> Yes, but I want to know about the codes, not the text.  If the codes exist,
> they are easier to work with than the text.

I find this code useful. You can build a hash from which you can extract more
useful error messages.

perl -MPg <<'EOF'
print map { "$_ => ".$Pg::{$_}->()."\n" }
      sort grep { /^PGRES_/ }
      keys %Pg::
EOF

=== output ===
PGRES_BAD_RESPONSE => 5
PGRES_COMMAND_OK => 1
PGRES_CONNECTION_BAD => 1
PGRES_CONNECTION_OK => 0
PGRES_COPY_IN => 4
PGRES_COPY_OUT => 3
PGRES_EMPTY_QUERY => 0
PGRES_FATAL_ERROR => 7
PGRES_INV_ARCHIVE => 65536
PGRES_INV_READ => 262144
PGRES_INV_SMGRMASK => 65535
PGRES_INV_WRITE => 131072
PGRES_InvalidOid => 0
PGRES_NONFATAL_ERROR => 6
PGRES_TUPLES_OK => 2
================

>
> -Fran
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly

--
Martijn van Oosterhout <kleptog@svana.org>
http://svana.org/kleptog/
> Magnetism, electricity and motion are like a three-for-two special offer:
> if you have two of them, the third one comes free.

pgsql-general by date:

Previous
From: "H. Wade Minter"
Date:
Subject: Re: Where to count
Next
From: o2@trustcommerce.com
Date:
Subject: Planner won't use indexes