Thread: Bug #670: netmask displayed for a /32
Edwin Groothuis (edwin@mavetju.org) reports a bug with a severity of 3 The lower the number the more severe it is. Short Description netmask displayed for a /32 Long Description The documentation says (chapter 3.8.1): The input format for this type is x.x.x.x/y where x.x.x.x is an IP address and y is the number of bits in the netmask. Ifthe /y part is left off, then the netmask is 32, and the value represents just a single host. On display, the /y portionis suppressed if the netmask is 32. This works fine in this case: pmoanalysis=> select ipaddress from dhcpservers; ipaddress ----------- 1.2.3.4 (1 row) But the /y portion is shown in this case: pmoanalysis=> select ipaddress||'a' from dhcpservers; ?column? ------------- 1.2.3.4/32a (1 row) I'm running pgsql version 7.2 under FreeBSD Sample Code No file was uploaded with this report
pgsql-bugs@postgresql.org writes: > But the /y portion is shown in this case: > pmoanalysis=> select ipaddress||'a' from dhcpservers; > ?column? > ------------- > 1.2.3.4/32a > (1 row) This implicitly coerces the inet value to text datatype, and the text(inet) function always displays netmask. Perhaps you'd prefer to use host() or abbrev() to do the conversion to text. regards, tom lane
On Tue, May 21, 2002 at 10:12:20AM -0400, Tom Lane wrote: > pgsql-bugs@postgresql.org writes: > > But the /y portion is shown in this case: > > pmoanalysis=> select ipaddress||'a' from dhcpservers; > > ?column? > > ------------- > > 1.2.3.4/32a > > (1 row) > > This implicitly coerces the inet value to text datatype, and the > text(inet) function always displays netmask. Perhaps you'd prefer > to use host() or abbrev() to do the conversion to text. I've already changed it to use host(), was just a message to let you know that it might not have been working the way you expected it to do. Thanks for your reply and the database, it rocks :-) Edwin -- Edwin Groothuis | Personal website: http://www.MavEtJu.org edwin@mavetju.org | Interested in MUDs? Visit Fatal Dimensions: bash$ :(){ :|:&};: | http://www.FatalDimensions.org/