Bruce Momjian <pgman@candle.pha.pa.us> writes:
>> BTW, duplicating the ereport is no fun. I'd suggest the coding style
>> used in some other places, with errhint called in a conditional
>> expression:
> Why does the ': 0' work? I didn't figure that would work, but it does.
The return values of the errxxx() subfunctions don't matter (they all
just return zero anyway). What they do is stuff their arguments into
a behind-the-scenes data structure that ereport will use when control
finally gets to it. ereport is declared as taking a "..." argument
list, but it makes no attempt to actually look at what was passed as
its arguments. So we don't really care what happens when the
?-expression test fails, as long as errhint() doesn't execute. A
constant zero is about the minimum thing we can put in the else-part
to keep the compiler happy.
regards, tom lane