From 9c8d0850c367e3f5eaac1f608c183311216f1cb0 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sat, 31 Jul 2004 23:04:58 +0000 Subject: Support "OR condition ..." in plpgsql EXCEPTION clauses to make the syntax more nearly Oracle-equivalent. Allow matching by category as well as specific error code. Document the set of available condition names (or more accurately, synchronize it with the existing documentation). In passing, update errcodes.sgml to include codes added during 7.5 development. --- src/include/utils/elog.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/include') diff --git a/src/include/utils/elog.h b/src/include/utils/elog.h index e9f2b0e879..4a2d26ddb9 100644 --- a/src/include/utils/elog.h +++ b/src/include/utils/elog.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/utils/elog.h,v 1.71 2004/07/31 00:45:43 tgl Exp $ + * $PostgreSQL: pgsql/src/include/utils/elog.h,v 1.72 2004/07/31 23:04:55 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -61,6 +61,10 @@ (PGSIXBIT(ch1) + (PGSIXBIT(ch2) << 6) + (PGSIXBIT(ch3) << 12) + \ (PGSIXBIT(ch4) << 18) + (PGSIXBIT(ch5) << 24)) +/* These macros depend on the fact that '0' becomes a zero in SIXBIT */ +#define ERRCODE_TO_CATEGORY(ec) ((ec) & ((1 << 12) - 1)) +#define ERRCODE_IS_CATEGORY(ec) (((ec) & ~((1 << 12) - 1)) == 0) + /* SQLSTATE codes for errors are defined in a separate file */ #include "utils/errcodes.h" -- cgit v1.2.1