8000 The macaddr datatype understands most formats of MAC address, except 12 · commandprompt/postgres@6b9e742 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6b9e742

Browse files
committed
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
1 parent cd7be4d commit 6b9e742

File tree

1 file changed

+3
-1
lines changed
  • src/backend/utils/adt

1 file changed

+3
-1
lines changed

src/backend/utils/adt/mac.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* PostgreSQL type definitions for MAC addresses.
33
*
4-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/mac.c,v 1.22 2002/03/09 17:35:35 tgl Exp $
4+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/mac.c,v 1.23 2002/06/15 19:39:33 momjian Exp $
55
*/
66

77
#include "postgres.h"
@@ -46,6 +46,8 @@ macaddr_in(PG_FUNCTION_ARGS)
4646
count = sscanf(str, "%2x%2x%2x-%2x%2x%2x", &a, &b, &c, &d, &e, &f);
4747
if (count != 6)
4848
count = sscanf(str, "%2x%2x.%2x%2x.%2x%2x", &a, &b, &c, &d, &e, &f);
49+
if (count != 6)
50+
count = sscanf(str, "%2x%2x%2x%2x%2x%2x", &a, &b, &c, &d, &e, &f);
4951

5052
if (count != 6)
5153
elog(ERROR, "macaddr_in: error in parsing \"%s\"", str);

0 commit comments

Comments
 (0)
0