Changed error level to NOTICE and return NULL when an error is encountered
This commit is contained in:
parent
1cec318025
commit
059897bf90
@ -1,9 +1,9 @@
|
||||
CREATE FUNCTION rdns_lookup(text)
|
||||
RETURNS text
|
||||
AS '$libdir/rdns'
|
||||
IMMUTABLE AS '$libdir/rdns'
|
||||
LANGUAGE C STRICT;
|
||||
|
||||
CREATE FUNCTION circular_rdns_lookup(text)
|
||||
RETURNS text
|
||||
AS '$libdir/rdns'
|
||||
IMMUTABLE AS '$libdir/rdns'
|
||||
LANGUAGE C STRICT;
|
||||
|
6
rdns.c
6
rdns.c
@ -61,14 +61,16 @@ Datum circular_rdns_lookup(PG_FUNCTION_ARGS) {
|
||||
if (r == EAI_NONAME)
|
||||
PG_RETURN_NULL();
|
||||
if (r) {
|
||||
ereport(ERROR, (errcode(ERRCODE_SYSTEM_ERROR), errmsg("getnameinfo failed! %s", gai_strerror(r))));
|
||||
ereport(NOTICE, (errcode(ERRCODE_SYSTEM_ERROR), errmsg("getnameinfo failed for IP `%s`, %s", ip, gai_strerror(r))));
|
||||
PG_RETURN_NULL();
|
||||
}
|
||||
|
||||
hint.ai_family = AF_INET;
|
||||
|
||||
r = getaddrinfo(host, 0, &hint, &results);
|
||||
if (r) {
|
||||
ereport(ERROR, (errcode(ERRCODE_SYSTEM_ERROR), errmsg("getaddrinfo failed! %s", gai_strerror(r))));
|
||||
ereport(NOTICE, (errcode(ERRCODE_SYSTEM_ERROR), errmsg("getaddrinfo failed for host `%s`, %s", host, gai_strerror(r))));
|
||||
PG_RETURN_NULL();
|
||||
}
|
||||
|
||||
c = results;
|
||||
|
Loading…
x
Reference in New Issue
Block a user