Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd7cff12

Browse files
committed
Add macro PGWARNING, and make PGERROR available on all platforms.
We'd previously noted the need for coping with Windows headersthat provide some other definition of macro "ERROR" than elog.hdoes. It turns out that R also wants to define ERROR, andWARNING too. PL/R has been working around this in a hacky waythat broke when we recently changed the numeric value of ERROR.To let them have a more future-proof solution, provide analternate macro PGWARNING for WARNING, and make PGERROR visiblealways, not only when #ifdef WIN32.Discussion:https://postgr.es/m/CADK3HHK6iMChd1yoOqssxBn5Z14Zar8Ztr3G-N_fuG7F8YTP3w@mail.gmail.com
1 parent9cb9233 commitd7cff12

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

‎src/include/utils/elog.h

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,22 @@
4040
#defineWARNING19/* Warnings. NOTICE is for expected messages
4141
* like implicit sequence creation by SERIAL.
4242
* WARNING is for unexpected messages. */
43+
#definePGWARNING19/* Must equal WARNING; see NOTE below. */
4344
#defineWARNING_CLIENT_ONLY20/* Warnings to be sent to client as usual, but
4445
* never to the server log. */
4546
#defineERROR21/* user error - abort transaction; return to
4647
* known state */
47-
/* Save ERROR value in PGERROR so it can be restored when Win32 includes
48-
* modify it. We have to use a constant rather than ERROR because macros
49-
* are expanded only when referenced outside macros.
50-
*/
51-
#ifdefWIN32
52-
#definePGERROR21
53-
#endif
48+
#definePGERROR21/* Must equal ERROR; see NOTE below. */
5449
#defineFATAL22/* fatal error - abort process */
5550
#definePANIC23/* take down the other backends with me */
5651

52+
/*
53+
* NOTE: the alternate names PGWARNING and PGERROR are useful for dealing
54+
* with third-party headers that make other definitions of WARNING and/or
55+
* ERROR. One can, for example, re-define ERROR as PGERROR after including
56+
* such a header.
57+
*/
58+
5759

5860
/* macros for representing SQLSTATE strings compactly */
5961
#definePGSIXBIT(ch)(((ch) - '0') & 0x3F)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp