Re: ECPG patch causes warning

From: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Magnus Hagander <magnus(at)hagander(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Michael Meskes <meskes(at)postgresql(dot)org>
Subject: Re: ECPG patch causes warning
Date: 2010-01-10 16:35:41
Message-ID: 4B4A01DD.2020309@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane írta:
> Magnus Hagander <magnus(at)hagander(dot)net> writes:
>
>> The ecpg patch at
>> http://git.postgresql.org/gitweb?p=postgresql.git;a=commit;h=2f567552
>> causes a compile warning on win64 (andi think win32, but I didn't
>> recheck that). Specifically, line 140 of typename.c has:
>> return (-type);
>>
>
>
>> Where type is of type Oid, which is unsigned.
>>
>
> I think that the compiler has caught an actual mistake here.
>

Yes, it's a mistake, but not an actual bug.
The intent was to be able to catch unhandled
cases in the application, just as in ecpg_dynamic_type().
The fix for sqlda_dynamic_type() is to use the same cast:

return -(int) type;

Should I send a patch for this?

> It looks to me like the patch is attempting to use a 'negative'
> Oid to signal a problem, and that simply is going to break as soon
> as the Oid counter runs past 2G. Perhaps InvalidOid is the thing
> to use here? I did not look at the call sites though.
>
> regards, tom lane
>
>

--
Bible has answers for everything. Proof:
"But let your communication be, Yea, yea; Nay, nay: for whatsoever is more
than these cometh of evil." (Matthew 5:37) - basics of digital technology.
"May your kingdom come" - superficial description of plate tectonics

----------------------------------
Zoltán Böszörményi
Cybertec Schönig & Schönig GmbH
http://www.postgresql.at/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2010-01-10 16:40:37 Re: Streaming replication status
Previous Message Tom Lane 2010-01-10 16:15:38 Re: ECPG patch causes warning