Re: Portability concerns over pq_sendbyte?
От
Andres Freund
Тема
Re: Portability concerns over pq_sendbyte?
Дата
Msg-id
20180613210852.ypebycgizswthv27@alap3.anarazel.de
Ответ на
Re: Portability concerns over pq_sendbyte? (Andrew Gierth)
Список
Дерево обсуждения
Portability concerns over pq_sendbyte? Andrew Gierth <andrew@tao11.riddles.org.uk>
Re: Portability concerns over pq_sendbyte? Michael Paquier <michael@paquier.xyz>
Re: Portability concerns over pq_sendbyte? Alvaro Herrera <alvherre@2ndquadrant.com>
Re: Portability concerns over pq_sendbyte? Michael Paquier <michael@paquier.xyz>
Re: Portability concerns over pq_sendbyte? Michael Paquier <michael@paquier.xyz>
Re: Portability concerns over pq_sendbyte? Andres Freund <andres@anarazel.de>
Re: Portability concerns over pq_sendbyte? Michael Paquier <michael@paquier.xyz>
Re: Portability concerns over pq_sendbyte? Alvaro Herrera <alvherre@2ndquadrant.com>
Re: Portability concerns over pq_sendbyte? Tom Lane <tgl@sss.pgh.pa.us>
Re: Portability concerns over pq_sendbyte? Andres Freund <andres@anarazel.de>
Re: Portability concerns over pq_sendbyte? Andres Freund <andres@anarazel.de>
Re: Portability concerns over pq_sendbyte? Michael Paquier <michael@paquier.xyz>
Re: Portability concerns over pq_sendbyte? Andres Freund <andres@anarazel.de>
Re: Portability concerns over pq_sendbyte? Andrew Gierth <andrew@tao11.riddles.org.uk>
Re: Portability concerns over pq_sendbyte? Andres Freund <andres@anarazel.de>
Hi, On 2018-06-13 22:02:13 +0100, Andrew Gierth wrote: > >>>>> "Andres" == Andres Freund writes: > > >> unsigned char x = 128; > >> pq_sendbyte(&buf, x); > >> > >> which I believe is not well-defined since pq_sendbyte takes an int8, > >> and conversions of unrepresentable values to _signed_ integer types > >> are (iirc) implementation-dependent. > > Andres> It's not implementation defined in postgres' dialect of C - we > Andres> rely on accurate signed->unsigned conversions in a number of > Andres> places. > > Converting signed integer to unsigned is ok as I understand it - what's > happening here is the reverse, converting an unrepresentable unsigned > value to a signed type. Err, yes, I was thinking about that conversion. Sorry for the confusion. > >> There are also some cases where pq_sendint16 is being called for an > >> unsigned value or a value that might exceed 32767. > > Andres> Hm, which case were you thinking of here? The calls usually are > Andres> exactly the types that the wire protocol expects, no? > > There are cases where it's not actually clear what the wire protocol > expects - I'm thinking in particular of the number of entries in a list > of parameter types/formats. But that didn't change around the pq_send* changes? So I'm not sure I understand how this is related? I mean I'm all for documenting the wire protocol more extensively, but we can't just change the width? Greetings, Andres Freund
В списке pgsql-hackers по дате отправления