AW: More on elog and error codes

From: Zeugswetter Andreas SB <ZeugswetterA(at)wien(dot)spardat(dot)at>
To: "'Peter Eisentraut'" <peter_e(at)gmx(dot)net>, Philip Warner <pjw(at)rhyme(dot)com(dot)au>
Cc: PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: AW: More on elog and error codes
Date: 2001-03-20 16:53:47
Message-ID: 11C1E6749A55D411A9670001FA687963368256@sdexcsrv1.f000.d0188.sd.spardat.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> #define PGERR_TYPE 1854

#define PGSQLSTATE_TYPE "S0021" // char(5) SQLSTATE

The standard calls this error variable SQLSTATE
(look up in ESQL standard)

first 2 chars are class next 3 are subclass

"00000" is e.g. Success
"02000" is Data not found
"U0xxx" user defined routine error xxx is user defined

> /* somewhere... */
>
> elogc(ERROR, PGERR_TYPE, "type %s cannot be created because it already exists", ...)

PGELOG(ERROR, PGSQLSTATE_TYPE, ("type %s cannot be created because it already exists", ...))

put varargs into parentheses to avoid need for ... macros see Tom's proposal

I also agree, that we can group different text messages into the same SQLSTATE,
if it seems appropriate for the client to handle them alike.

Andreas

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Larry Rosenman 2001-03-20 16:57:38 Re: AW: Re: More on elog and error codes
Previous Message Peter Eisentraut 2001-03-20 16:53:42 Re: AW: Re: More on elog and error codes