Re: Error Codes?

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Fran Fabrizio <ffabrizio(at)mmrd(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Error Codes?
Date: 2001-10-11 01:05:01
Message-ID: 20011011110501.A21264@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly

--
Martijn van Oosterhout <kleptog(at)svana(dot)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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message o2 2001-10-11 01:43:35 Planner won't use indexes
Previous Message Stuart Bishop 2001-10-11 00:53:46 Re: phonetic and/or synonym search