Q: inet operators for IPv4 encapsulated in IPv6

From: Albrecht Dreß <albrecht(dot)dress(at)posteo(dot)de>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Q: inet operators for IPv4 encapsulated in IPv6
Date: 2023-09-06 14:51:27
Message-ID: SXMXUDTK.3SCF2S3E.4WL2Z437@M4LKTL7F.IEVOZHH2.TS4HJ37P
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I have a question regarding the use of inet operators in environments with mixed IPv4 and IPv6 notations.

Consider the example from sect. 9.12. “Network Address Functions and Operators” in the docs which returns properly

<snip>
postgres=# select '192.168.1.5'::inet << '192.168.1/24'::inet;
?column?
----------
t
(1 row)
</snip>

However, for an IPv6 encapsulated IPv4 address, the result is

<snip>
postgres=# select '::ffff:192.168.1.5'::inet << '192.168.1/24'::inet;
?column?
----------
f
(1 row)
</snip>

Although the representation is different, in reality '192.168.1.5' and '::ffff:192.168.1.5' designate the same node, so IMHO it would be logical if the second statement would also return True. Is there any option to simply achieve this? I use PostgreSQL v. 15 on a Debian Bookworm box.

Thanks in advance, Albrecht.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Helmut Bender 2023-09-06 15:22:50 Re: postgreSQL UPPER Method is converting the character "µ" into "M"
Previous Message Erik Wienhold 2023-09-06 14:23:28 Re: postgreSQL UPPER Method is converting the character "µ" into "M"