Wire protocol encoding for 'inet' type is defined unreliably

Started by Duncan Smithabout 11 years ago2 messagesbugs
Jump to latest
#1Duncan Smith
Duncan@xrtc.net

Hi,

I noticed today that the network encoding of the 'inet' type uses values
derived from the system header file <sys/socket.h> to tag whether the
address is IPv4 or IPv6.

In particular, <src/include/utils/inet.h> defines PGSQL_AF_INET to be
AF_INET, which is 2 on my system. Wouldn't it be better to use a more
constant constant for this purpose?

--
Duncan Smith

--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Duncan Smith (#1)
Re: Wire protocol encoding for 'inet' type is defined unreliably

Duncan Smith <Duncan@xrtc.net> writes:

I noticed today that the network encoding of the 'inet' type uses values
derived from the system header file <sys/socket.h> to tag whether the
address is IPv4 or IPv6.

In particular, <src/include/utils/inet.h> defines PGSQL_AF_INET to be
AF_INET, which is 2 on my system. Wouldn't it be better to use a more
constant constant for this purpose?

Yeah, in a green field that would have been the thing to do, but at
this point it's years too late to change it. If there are any platforms
where AF_INET is different from 2, changing those constants would break
both on-disk storage and binary-format dumps for them.

regards, tom lane

--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs