Kurt Roeckx <Q@ping.be> writes:
> On Thu, Jan 30, 2003 at 11:28:41AM -0500, Tom Lane wrote:
>> We have to work out what the semantics should be. I don't know anything
>> about v6, but I'd imagine v4 addresses form a defined subset of the v6
>> address space ... if so the semantics seem pretty straightforward.
> You have a "ipv4 mapped ipv6 address". The ipv4 address 1.2.3.4 becomes
> ::ffff:1.2.3.4. But I'm not really in favour of automatically
> changing an ipv4 address to an ipv6 address. And you really
> shouldn't return an ipv4 address as an ipv6 address.
No, we should keep the distinction for purposes of storage and display.
The question was about what the semantics should be when comparing v4
and v6 addresses in operations like network_sub. It seems perfectly
reasonable to convert the v4 address to the mapped v6 equivalent and then
do a v6 comparison in that situation. Do we have any operators where
this would not be a sensible definition?
> My question really is how you're going to store it. Are you
> going to store is as a character string, or as binary?
Binary, same as we do now for v4.
> If you store is as binary, how will you know if it's an ipv4 or
> ipv6 address? Based on the size?
Why not?
regards, tom lane