Обсуждение: BUG #17550: inet type doesn't accept alternate notations of ipv4 addresses
BUG #17550: inet type doesn't accept alternate notations of ipv4 addresses
От
PG Bug reporting form
Дата:
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
Re: BUG #17550: inet type doesn't accept alternate notations of ipv4 addresses
От
Francisco Olarte
Дата:
Doeke: On Thu, 14 Jul 2022 at 17:04, PG Bug reporting form <noreply@postgresql.org> wrote: ... > Anyways, the documentation about the inet-type could say it only accepts > normalized forms of addresses. Asked and answered? I mean, you've already classified this as not a bug but a wish, or a feature request. Francisco Olarte.
Re: BUG #17550: inet type doesn't accept alternate notations of ipv4 addresses
От
"David G. Johnston"
Дата:
On Thu, Jul 14, 2022 at 9:52 AM Francisco Olarte <folarte@peoplecall.com> wrote:
Doeke:
On Thu, 14 Jul 2022 at 17:04, PG Bug reporting form
<noreply@postgresql.org> wrote:
...
> Anyways, the documentation about the inet-type could say it only accepts
> normalized forms of addresses.
Asked and answered? I mean, you've already classified this as not a
bug but a wish, or a feature request.
I don't see it as unreasonable to claim the lack of documentation regarding known alternative representations that could be accepted as input is a bug. The actual report isn't even asking for us to implement acceptance of those formats, just make it clear when someone gets that error and checks the docs that the error is valid.
David J.
"David G. Johnston" <david.g.johnston@gmail.com> writes: > I don't see it as unreasonable to claim the lack of documentation regarding > known alternative representations that could be accepted as input is a > bug. The actual report isn't even asking for us to implement acceptance of > those formats, just make it clear when someone gets that error and checks > the docs that the error is valid. Yeah. I'm disinclined to loosen the input syntax rules, but the docs could stand improvement I think. Particularly since there are no concrete examples in https://www.postgresql.org/docs/current/datatype-net-types.html#DATATYPE-INET but there are in the following section about CIDR --- and that type *does* allow some forms of abbreviation. It would not be unreasonable to assume that INET does too. regards, tom lane