BUG #17550: inet type doesn't accept alternate notations of ipv4 addresses - Mailing list pgsql-bugs

From PG Bug reporting form
Subject BUG #17550: inet type doesn't accept alternate notations of ipv4 addresses
Date
Msg-id 17550-277c0ecd43597da9@postgresql.org
Whole thread Raw
Responses Re: BUG #17550: inet type doesn't accept alternate notations of ipv4 addresses  (Francisco Olarte <folarte@peoplecall.com>)
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      17550
Logged by:          Doeke Zanstra
Email address:      doekman@icloud.com
PostgreSQL version: 13.7
Operating system:   MacOS Monterey
Description:

When I use the following strings as value for inet-type fields, I get the
error "ERROR:  invalid input syntax for type inet" for the first three
insert statements.

    create table e (id serial primary key, ip_addr inet not null);
    insert into e(ip_addr) values ('127.1'); -- short syntax for 127.0.0.1
    insert into e(ip_addr) values ('3232281089'); -- integer version of
192.168.178.1
    insert into e(ip_addr) values ('0xc0a8b201'); -- hex version of
192.168.178.1
    insert into e(ip_addr) values ('192.168.178.1'); -- this one does work

The alternate syntax does work in Safari, and on command line utilities like
ping.
And if memory serves well, it worked in InternetExplorer 5.5 on Windows 2000
back in 2002.

Anyways, the documentation about the inet-type could say it only accepts
normalized forms of addresses. 

The wikipedia has some info on this:

https://en.wikipedia.org/wiki/IPv4#Address_representations


pgsql-bugs by date:

Previous
From: hubert depesz lubaczewski
Date:
Subject: Excessive number of replication slots for 12->14 logical replication
Next
From: David Johansen
Date:
Subject: Re: Auto-vacuum timing out and preventing connections