Skip to content

Commit aab2979

Browse files
jianhe-funCommitfest Bot
authored andcommitted
error safe for casting macaddr8 to other types per pg_cast
select castsource::regtype, casttarget::regtype, castfunc, castcontext,castmethod, pp.prosrc, pp.proname from pg_cast pc join pg_proc pp on pp.oid = pc.castfunc and pc.castfunc > 0 and castsource::regtype ='macaddr8'::regtype order by castsource::regtype; castsource | casttarget | castfunc | castcontext | castmethod | prosrc | proname ------------+------------+----------+-------------+------------+-------------------+--------- macaddr8 | macaddr | 4124 | i | f | macaddr8tomacaddr | macaddr (1 row) discussion: https://postgr.es/m/CADkLM=fv1JfY4Ufa-jcwwNbjQixNViskQ8jZu3Tz_p656i_4hQ@mail.gmail.com
1 parent 957e357 commit aab2979

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/backend/utils/adt/mac8.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ macaddr8tomacaddr(PG_FUNCTION_ARGS)
550550
result = (macaddr *) palloc0(sizeof(macaddr));
551551

552552
if ((addr->d != 0xFF) || (addr->e != 0xFE))
553-
ereport(ERROR,
553+
ereturn(fcinfo->context, (Datum) 0,
554554
(errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
555555
errmsg("macaddr8 data out of range to convert to macaddr"),
556556
errhint("Only addresses that have FF and FE as values in the "

0 commit comments

Comments
 (0)