diff options
Diffstat (limited to 'src/backend/utils/adt/network.c')
-rw-r--r-- | src/backend/utils/adt/network.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/backend/utils/adt/network.c b/src/backend/utils/adt/network.c index 69c7ac182f0..3a705da6197 100644 --- a/src/backend/utils/adt/network.c +++ b/src/backend/utils/adt/network.c @@ -472,6 +472,33 @@ network_ne(PG_FUNCTION_ARGS) } /* + * MIN/MAX support functions. + */ +Datum +network_smaller(PG_FUNCTION_ARGS) +{ + inet *a1 = PG_GETARG_INET_PP(0); + inet *a2 = PG_GETARG_INET_PP(1); + + if (network_cmp_internal(a1, a2) < 0) + PG_RETURN_INET_P(a1); + else + PG_RETURN_INET_P(a2); +} + +Datum +network_larger(PG_FUNCTION_ARGS) +{ + inet *a1 = PG_GETARG_INET_PP(0); + inet *a2 = PG_GETARG_INET_PP(1); + + if (network_cmp_internal(a1, a2) > 0) + PG_RETURN_INET_P(a1); + else + PG_RETURN_INET_P(a2); +} + +/* * Support function for hash indexes on inet/cidr. */ Datum |