From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Teodor Sigaev <teodor(at)sigaev(dot)ru> |
Cc: | Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr> |
Subject: | Re: stringify MAKE_SQLSTATE() |
Date: | 2015-07-22 13:59:22 |
Message-ID: | 18021.1437573562@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Teodor Sigaev <teodor(at)sigaev(dot)ru> writes:
> Following discussion at https://commitfest.postgresql.org/5/190/ patch, I found
> (at seems to me) a way to stringify MAKE_SQLSTATE(), the idea is to use char
> array as string:
> #define MAKE_SQLSTATE(ch1,ch2,ch3,ch4,ch5) \
> ((char[]){(char)(ch1),(char)(ch2),(char)(ch3),(char)(ch4),(char)(ch5),(char)'\0'})
I'm pretty sure that's a gcc-ism, not standard C.
As I mentioned in the other thread, if we wanted to provide string
versions of the ERRCODE macros, the safest way to do it would be
to create a separate header file with defines like
#define ERRCODE_WARNING_DEPRECATED_FEATURE "01P01"
Now that we generate errcodes.h from errcodes.txt anyway, it would
certainly be a trivial extension of the build infrastructure to make
a second header like this.
The real question is do we want to. What's your use-case for this?
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2015-07-22 13:59:23 | Re: optimizing vacuum truncation scans |
Previous Message | Teodor Sigaev | 2015-07-22 13:52:52 | stringify MAKE_SQLSTATE() |