Re: macaddr data type issue

From: Larry Rosenman <ler(at)lerctr(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Justin Clift <justin(at)postgresql(dot)org>, Gayland Gump <gumpg(at)pacifier(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: macaddr data type issue
Date: 2001-08-21 19:12:41
Message-ID: 20010821141241.B9669@lerami.lerctr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

* Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> [010821 14:10]:
> Justin Clift <justin(at)postgresql(dot)org> writes:
> > What you're attempting to insert is being interpreted as the NULL value
>
> Actually, it's not NULL. The curious behavior comes from a test in the
> macaddr_out routine that causes it to produce an empty-string display if
> the MAC address is all zeroes:
>
> if ((hibits(addr) > 0) || (lobits(addr) > 0))
> {
> sprintf(result, "%02x:%02x:%02x:%02x:%02x:%02x",
> addr->a, addr->b, addr->c, addr->d, addr->e, addr->f);
> }
> else
> {
> result[0] = '\0'; /* special case for missing address */
> }
>
> This seems a tad bizarre to me, if not an outright bug. The right,
> SQL-approved way to represent "missing data" is as a NULL; there's no
> rationale I can see for treating an all-zeroes address like this.
>
> There's also a special case in macaddr_in that accepts an empty input
> string as meaning an all-zeroes address. This seems bogus as well.
>
> I'm inclined to rip out both special cases, so that an all-zeroes MAC
> address is handled exactly like any other address. Comments?
My gut feeling is that Tom is correct, and there should be no special
cases here.

LER
--
Larry Rosenman http://www.lerctr.org/~ler
Phone: +1 972-414-9812 E-Mail: ler(at)lerctr(dot)org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Carlos Felipe Zirbes 2001-08-21 19:16:30 RE: New RPMS ?
Previous Message Jason Earl 2001-08-21 18:52:24 Re: time interval question