Re: mac.c

Поиск
Список
Период
Сортировка
От Larry Rosenman
Тема Re: mac.c
Дата
Msg-id 20000820175058.A15912@lerami.lerctr.org
обсуждение исходный текст
Ответ на Re: mac.c  (Thomas Lockhart <lockhart@alumni.caltech.edu>)
Список pgsql-hackers
Thanks Thomas!

I just didn't want the ideas to die. 

Larry

* Thomas Lockhart <lockhart@alumni.caltech.edu> [000820 14:28]:
> > Does anyone want to do the coding we've talked about?
> 
> OK, here is what I have so far, based on the work of Larry, Alex, and
> others:
> 
> o Two new functions, trunc(macaddr) and text(macaddr), where the former
> returns the mac address with the low (non-manufacturer) fields zeroed
> out, and the latter converts to a text string. The text conversion is
> nice because capabilities such as LIKE can be used transparently :) Will
> need to add macaddr(text) for symmetry.
> 
> o Two utilities for contrib/mac, createoui and updateoui. The former
> creates a table "macoui" with the fields oui and manufacturer. The
> latter populates it with the contents of the file oui.txt, fetched from
> the IEEE web site and processed by a slightly modified version of
> Larry's awk script.
> 
> o An sql definition file, manuf.sql, which defines a function
> manuf(macaddr) along the lines Alex had suggested. It returns a text
> string of the manufacturer's name, or NULL if none is matched. You can
> use COALESCE() to return something other than NULL if you want.
> 
> Should we have updateoui use wget to fetch oui.txt from the IEEE web
> site? Or perhaps better we could have that in a separate utility?
> 
> Comments?
> 
>                    - Thomas
> 
> Some examples are
> 
> myst> ./createoui
> myst> ./updateoui
> 
> lockhart=# select trunc(macaddr '00:01:a0:aa:bb:cc');
>        trunc
> -------------------
>  00:01:a0:00:00:00
> (1 row)
> 
> lockhart=# select manuf('01:02:03:00:00:00');
>  manuf
> -------
> 
> (1 row)
> 
> lockhart=# select manuf('00:01:a0:00:00:00');
>          manuf
> ------------------------
>  Infinilink Corporation
> (1 row)
> 
> lockhart=# select manuf('00:01:A0:00:00:00');
>          manuf
> ------------------------
>  Infinilink Corporation
> (1 row)
> 
> lockhart=# select manuf('00:01:A0:00:00:01');
>          manuf
> ------------------------
>  Infinilink Corporation
> (1 row)
> 
> lockhart=# select coalesce(manuf('01:02:03:00:00:00'), 'nada');
>  case
> ------
>  nada
> (1 row)
> 
> lockhart=# select * from macoui where oui like '00:aa%';
>         oui        |         manufacturer          
> -------------------+-------------------------------
>  00:aa:00:00:00:00 | INTEL CORPORATION
>  00:aa:01:00:00:00 | INTEL CORPORATION
>  00:aa:02:00:00:00 | INTEL CORPORATION
>  00:aa:3c:00:00:00 | OLIVETTI TELECOM SPA (OLTECO)
> (4 rows)
> 
> lockhart=# select * from macoui where oui like '00:AA%';
>  oui | manufacturer 
> -----+--------------
> (0 rows)
> 
> lockhart=# select * from macoui where oui ilike '00:AA%';
>         oui        |         manufacturer          
> -------------------+-------------------------------
>  00:aa:00:00:00:00 | INTEL CORPORATION
>  00:aa:01:00:00:00 | INTEL CORPORATION
>  00:aa:02:00:00:00 | INTEL CORPORATION
>  00:aa:3c:00:00:00 | OLIVETTI TELECOM SPA (OLTECO)
> (4 rows)
-- 
Larry Rosenman                      http://www.lerctr.org/~ler
Phone: +1 972-414-9812 (voice) Internet: ler@lerctr.org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749


В списке pgsql-hackers по дате отправления:

Предыдущее
От: The Hermit Hacker
Дата:
Сообщение: Re: How Do You Pronounce "PostgreSQL"?
Следующее
От: Don Baccus
Дата:
Сообщение: Re: Optimisation deficiency: currval('seq')-->seq scan, constant-->index scan