diff options
Diffstat (limited to 'src/backend/utils/adt/network.c')
-rw-r--r-- | src/backend/utils/adt/network.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/backend/utils/adt/network.c b/src/backend/utils/adt/network.c index 6d580ea78f6..42a4d9d44ec 100644 --- a/src/backend/utils/adt/network.c +++ b/src/backend/utils/adt/network.c @@ -72,7 +72,7 @@ static inet *internal_inetpl(inet *ip, int64 addend); * Common INET/CIDR input routine */ static inet * -network_in(char *src, bool is_cidr) +network_in(char *src, bool is_cidr, Node *escontext) { int bits; inet *dst; @@ -93,7 +93,7 @@ network_in(char *src, bool is_cidr) bits = pg_inet_net_pton(ip_family(dst), src, ip_addr(dst), is_cidr ? ip_addrsize(dst) : -1); if ((bits < 0) || (bits > ip_maxbits(dst))) - ereport(ERROR, + ereturn(escontext, NULL, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), /* translator: first %s is inet or cidr */ errmsg("invalid input syntax for type %s: \"%s\"", @@ -105,7 +105,7 @@ network_in(char *src, bool is_cidr) if (is_cidr) { if (!addressOK(ip_addr(dst), bits, ip_family(dst))) - ereport(ERROR, + ereturn(escontext, NULL, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), errmsg("invalid cidr value: \"%s\"", src), errdetail("Value has bits set to right of mask."))); @@ -122,7 +122,7 @@ inet_in(PG_FUNCTION_ARGS) { char *src = PG_GETARG_CSTRING(0); - PG_RETURN_INET_P(network_in(src, false)); + PG_RETURN_INET_P(network_in(src, false, fcinfo->context)); } Datum @@ -130,7 +130,7 @@ cidr_in(PG_FUNCTION_ARGS) { char *src = PG_GETARG_CSTRING(0); - PG_RETURN_INET_P(network_in(src, true)); + PG_RETURN_INET_P(network_in(src, true, fcinfo->context)); } @@ -1742,7 +1742,7 @@ inet_client_addr(PG_FUNCTION_ARGS) clean_ipv6_addr(port->raddr.addr.ss_family, remote_host); - PG_RETURN_INET_P(network_in(remote_host, false)); + PG_RETURN_INET_P(network_in(remote_host, false, NULL)); } @@ -1814,7 +1814,7 @@ inet_server_addr(PG_FUNCTION_ARGS) clean_ipv6_addr(port->laddr.addr.ss_family, local_host); - PG_RETURN_INET_P(network_in(local_host, false)); + PG_RETURN_INET_P(network_in(local_host, false, NULL)); } |