Re: mac.c - Mailing list pgsql-hackers

From Tom Lane
Subject Re: mac.c
Date
Msg-id 6320.965663850@sss.pgh.pa.us
Whole thread Raw
In response to Re: mac.c  (Thomas Lockhart <lockhart@alumni.caltech.edu>)
Responses Re: mac.c  (Don Baccus <dhogaza@pacifier.com>)
List pgsql-hackers
Thomas Lockhart <lockhart@alumni.caltech.edu> writes:
> Why not implement like() and notlike() for macaddr data types which (if
> both args are macaddr) will compare on manufacturer's fields alone? That
> would seem to get all the functionality you might want.

That seems like an entirely unjustified overloading of the "LIKE"
operator.  I don't see any reason why someone would expect a string-
pattern-match operator to have the semantics of "compare the
manufacturer part only" when applied to macaddr.

> That would avoid ginning up something artificial like a macaddr with
> some fields zeroed out.

If you don't like that, provide a function that extracts the
manufacturer part as a text string (and I guess another to extract the
low-order bits as text).  Then a lookup to get the manufacturer name can
be done as a text-field search.  There is plenty of precedent in the
inet/cidr functions for extracting portions of a data value as text
strings.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Thomas Swan
Date:
Subject: UNIONS
Next
From: Thomas Lockhart
Date:
Subject: Re: Re: [GENERAL] Trouble with float4 after upgrading from 6.5.3 to 7.0.2