
  -- pg_catalog.decode() expects the string to have an even number of
  -- chars, but Redwood hextoraw() does not. Pad the input with a
  -- leading zero if necessary.
  SELECT pg_catalog.decode(
    CASE WHEN pg_catalog.length($1) % 2 = 1 THEN ('0' || $1) ELSE $1 END,
    'hex')
