Re: PL/R regression on windows, but not linux with master. - Mailing list pgsql-hackers

From Tom Lane
Subject Re: PL/R regression on windows, but not linux with master.
Date
Msg-id 2688684.1618159378@sss.pgh.pa.us
Whole thread Raw
In response to Re: PL/R regression on windows, but not linux with master.  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: PL/R regression on windows, but not linux with master.  (Dave Cramer <davecramer@gmail.com>)
List pgsql-hackers
I wrote:
> Joe Conway <mail@joeconway.com> writes:
>> Would an equivalent "PGWARNING" be something we are open to adding and 
>> back-patching?

> It's not real obvious how pl/r could solve this in a reliable way
> otherwise, so adding that would be OK with me, but I wonder whether
> back-patching is going to help you any.  You'd still need to compile
> against older headers I should think.  So I'd suggest
> (1) add PGWARNING in HEAD only

Concretely, maybe like the attached?

            regards, tom lane

diff --git a/src/include/utils/elog.h b/src/include/utils/elog.h
index 9acb57a27b..f53607e12e 100644
--- a/src/include/utils/elog.h
+++ b/src/include/utils/elog.h
@@ -40,20 +40,22 @@
 #define WARNING        19            /* Warnings.  NOTICE is for expected messages
                                  * like implicit sequence creation by SERIAL.
                                  * WARNING is for unexpected messages. */
+#define PGWARNING    19            /* Must equal WARNING; see NOTE below. */
 #define WARNING_CLIENT_ONLY    20    /* Warnings to be sent to client as usual, but
                                  * never to the server log. */
 #define ERROR        21            /* user error - abort transaction; return to
                                  * known state */
-/* Save ERROR value in PGERROR so it can be restored when Win32 includes
- * modify it.  We have to use a constant rather than ERROR because macros
- * are expanded only when referenced outside macros.
- */
-#ifdef WIN32
-#define PGERROR        21
-#endif
+#define PGERROR        21            /* Must equal ERROR; see NOTE below. */
 #define FATAL        22            /* fatal error - abort process */
 #define PANIC        23            /* take down the other backends with me */
 
+/*
+ * NOTE: the alternate names PGWARNING and PGERROR are useful for dealing
+ * with third-party headers that make other definitions of WARNING and/or
+ * ERROR.  One can, for example, re-define ERROR as PGERROR after including
+ * such a header.
+ */
+
 
 /* macros for representing SQLSTATE strings compactly */
 #define PGSIXBIT(ch)    (((ch) - '0') & 0x3F)

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: psql - add SHOW_ALL_RESULTS option
Next
From: Peter Geoghegan
Date:
Subject: Re: PANIC: wrong buffer passed to visibilitymap_clear