Commit 6b9e7424 authored by Bruce Momjian's avatar Bruce Momjian

The macaddr datatype understands most formats of MAC address, except 12

hex digits with no separators, eg 00AABBCCDDEE. This is easily remedied
with the following patch (against 7.2.1):

Mike Wyer
parent cd7be4d9
/*
* PostgreSQL type definitions for MAC addresses.
*
* $Header: /cvsroot/pgsql/src/backend/utils/adt/mac.c,v 1.22 2002/03/09 17:35:35 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/mac.c,v 1.23 2002/06/15 19:39:33 momjian Exp $
*/
#include "postgres.h"
......@@ -46,6 +46,8 @@ macaddr_in(PG_FUNCTION_ARGS)
count = sscanf(str, "%2x%2x%2x-%2x%2x%2x", &a, &b, &c, &d, &e, &f);
if (count != 6)
count = sscanf(str, "%2x%2x.%2x%2x.%2x%2x", &a, &b, &c, &d, &e, &f);
if (count != 6)
count = sscanf(str, "%2x%2x%2x%2x%2x%2x", &a, &b, &c, &d, &e, &f);
if (count != 6)
elog(ERROR, "macaddr_in: error in parsing \"%s\"", str);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment