diff options
author | Bruce Momjian <bruce@momjian.us> | 2002-06-15 19:39:33 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 2002-06-15 19:39:33 +0000 |
commit | 6b9e742458df2256ca611b7aeef7ede72ca943f5 (patch) | |
tree | 457c68719a73d96f7c75c51d9e9f39363ff39744 | |
parent | cd7be4d9470c7b035774287817d19055792a097a (diff) | |
download | postgresql-6b9e742458df2256ca611b7aeef7ede72ca943f5.tar.gz postgresql-6b9e742458df2256ca611b7aeef7ede72ca943f5.zip |
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
-rw-r--r-- | src/backend/utils/adt/mac.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/backend/utils/adt/mac.c b/src/backend/utils/adt/mac.c index 0abd3a71e89..a531842205f 100644 --- a/src/backend/utils/adt/mac.c +++ b/src/backend/utils/adt/mac.c @@ -1,7 +1,7 @@ /* * 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); |