Should we create some user-friendly macros for the error field codes?  I
have a feeling that PGXYZ_SQLSTATE may make for better code than just 'C'.

-- 
Peter Eisentraut   peter_e@gmx.net

Mon, 28 Jul 2003 09:46:39 +0200 (CEST)
Peter Eisentraut <peter_e@gmx.net>
Some macros for error field codes
Peter Eisentraut <peter_e@gmx.net> writes:
> Should we create some user-friendly macros for the error field codes?  I
> have a feeling that PGXYZ_SQLSTATE may make for better code than just 'C'.

I just pushed the ERRCODE_ macros out into their own file.  How about
placing that file where client apps can include it directly?

Note though that I think client apps will want to test "is this code in
this class" about as often as they'll want to check for specific
codes.  We might need to provide some additional infrastructure to
handle that.

			regards, tom lane

Mon, 28 Jul 2003 03:57:08 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: Some macros for error field codes 
Tom Lane writes:

> > Should we create some user-friendly macros for the error field codes?  I
> > have a feeling that PGXYZ_SQLSTATE may make for better code than just 'C'.
>
> I just pushed the ERRCODE_ macros out into their own file.  How about
> placing that file where client apps can include it directly?

I was actually talking of the single-letter codes that are used on the
protocol layer to tag the different fields of an error or notice result.
That is, instead of

    PQresultErrorField(result, 'M')

I'd rather use something like

    PQresultErrorField(result, PGEF_MESSSAGE_TEXT)

I'm not actually eager to push out the wordy SQLSTATE macros to the
client, although some might argue for that.

-- 
Peter Eisentraut   peter_e@gmx.net

Mon, 28 Jul 2003 10:36:06 +0200 (CEST)
Peter Eisentraut <peter_e@gmx.net>
Re: Some macros for error field codes 
Peter Eisentraut <peter_e@gmx.net> writes:
>>> Should we create some user-friendly macros for the error field codes?

> I was actually talking of the single-letter codes that are used on the
> protocol layer to tag the different fields of an error or notice result.

Oh, those things.  Sure, if you like, though it might be just namespace
clutter.

			regards, tom lane

Mon, 28 Jul 2003 09:34:41 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: Some macros for error field codes 
Tom Lane wrote:
> Peter Eisentraut <peter_e@gmx.net> writes:
> >>> Should we create some user-friendly macros for the error field codes?
> 
> > I was actually talking of the single-letter codes that are used on the
> > protocol layer to tag the different fields of an error or notice result.
> 
> Oh, those things.  Sure, if you like, though it might be just namespace
> clutter.

Seems it documents the code more clearly.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Wed, 30 Jul 2003 17:41:56 -0400 (EDT)
Bruce Momjian <pgman@candle.pha.pa.us>
Re: Some macros for error field codes