*** a/src/backend/utils/adt/network.c
--- b/src/backend/utils/adt/network.c
***************
*** 471,476 **** network_ne(PG_FUNCTION_ARGS)
--- 471,499 ----
  	PG_RETURN_BOOL(network_cmp_internal(a1, a2) != 0);
  }
  
+ 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.
   */
*** a/src/include/catalog/pg_aggregate.h
--- b/src/include/catalog/pg_aggregate.h
***************
*** 164,169 **** DATA(insert ( 2050	n 0 array_larger	-				-				-				-				f f 1073	2277	0	0		0	_nu
--- 164,170 ----
  DATA(insert ( 2244	n 0 bpchar_larger	-				-				-				-				f f 1060	1042	0	0		0	_null_ _null_ ));
  DATA(insert ( 2797	n 0 tidlarger		-				-				-				-				f f 2800	27		0	0		0	_null_ _null_ ));
  DATA(insert ( 3526	n 0 enum_larger		-				-				-				-				f f 3519	3500	0	0		0	_null_ _null_ ));
+ DATA(insert ( 3251	n 0 network_larger	-				-				-				-				f f 1205	869		0	0		0	_null_ _null_ ));
  
  /* min */
  DATA(insert ( 2131	n 0 int8smaller		-				-				-				-				f f 412		20		0	0		0	_null_ _null_ ));
***************
*** 186,191 **** DATA(insert ( 2051	n 0 array_smaller	-				-				-				-				f f 1072	2277	0	0		0	_n
--- 187,193 ----
  DATA(insert ( 2245	n 0 bpchar_smaller	-				-				-				-				f f 1058	1042	0	0		0	_null_ _null_ ));
  DATA(insert ( 2798	n 0 tidsmaller		-				-				-				-				f f 2799	27		0	0		0	_null_ _null_ ));
  DATA(insert ( 3527	n 0 enum_smaller	-				-				-				-				f f 3518	3500	0	0		0	_null_ _null_ ));
+ DATA(insert ( 3252	n 0 network_smaller	-				-				-				-				f f 1203	869		0	0		0	_null_ _null_ ));
  
  /* count */
  DATA(insert ( 2147	n 0 int8inc_any		-				int8inc_any		int8dec_any		-				f f 0		20		0	20		0	"0" "0" ));
*** a/src/include/catalog/pg_proc.h
--- b/src/include/catalog/pg_proc.h
***************
*** 2120,2125 **** DATA(insert OID = 922 (  network_le			PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 1
--- 2120,2129 ----
  DATA(insert OID = 923 (  network_gt			PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "869 869" _null_ _null_ _null_ _null_	network_gt _null_ _null_ _null_ ));
  DATA(insert OID = 924 (  network_ge			PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "869 869" _null_ _null_ _null_ _null_	network_ge _null_ _null_ _null_ ));
  DATA(insert OID = 925 (  network_ne			PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 16 "869 869" _null_ _null_ _null_ _null_	network_ne _null_ _null_ _null_ ));
+ DATA(insert OID = 3253 (  network_larger	PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 869 "869 869" _null_ _null_ _null_ _null_	network_larger _null_ _null_ _null_ ));
+ DESCR("larger of two network types");
+ DATA(insert OID = 3254 (  network_smaller	PGNSP PGUID 12 1 0 0 0 f f f t t f i 2 0 869 "869 869" _null_ _null_ _null_ _null_	network_smaller _null_ _null_ _null_ ));
+ DESCR("smaller of two network types");
  DATA(insert OID = 926 (  network_cmp		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 23 "869 869" _null_ _null_ _null_ _null_	network_cmp _null_ _null_ _null_ ));
  DESCR("less-equal-greater");
  DATA(insert OID = 927 (  network_sub		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "869 869" _null_ _null_ _null_ _null_	network_sub _null_ _null_ _null_ ));
***************
*** 3161,3166 **** DATA(insert OID = 2244 (  max				PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1042 "
--- 3165,3172 ----
  DESCR("maximum value of all bpchar input values");
  DATA(insert OID = 2797 (  max				PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 27 "27" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
  DESCR("maximum value of all tid input values");
+ DATA(insert OID = 3251 (  max				PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 869 "869" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+ DESCR("maximum value of all inet input values");
  
  DATA(insert OID = 2131 (  min				PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 20 "20" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
  DESCR("minimum value of all bigint input values");
***************
*** 3200,3205 **** DATA(insert OID = 2245 (  min				PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 1042 "
--- 3206,3213 ----
  DESCR("minimum value of all bpchar input values");
  DATA(insert OID = 2798 (  min				PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 27 "27" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
  DESCR("minimum value of all tid input values");
+ DATA(insert OID = 3252 (  min				PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 869 "869" _null_ _null_ _null_ _null_ aggregate_dummy _null_ _null_ _null_ ));
+ DESCR("minimum value of all inet input values");
  
  /* count has two forms: count(any) and count(*) */
  DATA(insert OID = 2147 (  count				PGNSP PGUID 12 1 0 0 0 t f f f f f i 1 0 20 "2276" _null_ _null_ _null_ _null_	aggregate_dummy _null_ _null_ _null_ ));
*** a/src/include/utils/builtins.h
--- b/src/include/utils/builtins.h
***************
*** 907,912 **** extern Datum network_eq(PG_FUNCTION_ARGS);
--- 907,914 ----
  extern Datum network_ge(PG_FUNCTION_ARGS);
  extern Datum network_gt(PG_FUNCTION_ARGS);
  extern Datum network_ne(PG_FUNCTION_ARGS);
+ extern Datum network_smaller(PG_FUNCTION_ARGS);
+ extern Datum network_larger(PG_FUNCTION_ARGS);
  extern Datum hashinet(PG_FUNCTION_ARGS);
  extern Datum network_sub(PG_FUNCTION_ARGS);
  extern Datum network_subeq(PG_FUNCTION_ARGS);
*** a/src/test/regress/expected/create_function_3.out
--- b/src/test/regress/expected/create_function_3.out
***************
*** 153,389 **** RESET SESSION AUTHORIZATION;
  SELECT proname, prorettype::regtype, proargtypes::regtype[]
         FROM pg_proc JOIN pg_namespace ON pronamespace = pg_namespace.oid
         WHERE nspname = 'pg_catalog' AND proleakproof ORDER BY proname;
!     proname     | prorettype |                             proargtypes                             
! ----------------+------------+---------------------------------------------------------------------
!  abstimeeq      | boolean    | [0:1]={abstime,abstime}
!  abstimege      | boolean    | [0:1]={abstime,abstime}
!  abstimegt      | boolean    | [0:1]={abstime,abstime}
!  abstimele      | boolean    | [0:1]={abstime,abstime}
!  abstimelt      | boolean    | [0:1]={abstime,abstime}
!  abstimene      | boolean    | [0:1]={abstime,abstime}
!  biteq          | boolean    | [0:1]={bit,bit}
!  bitge          | boolean    | [0:1]={bit,bit}
!  bitgt          | boolean    | [0:1]={bit,bit}
!  bitle          | boolean    | [0:1]={bit,bit}
!  bitlt          | boolean    | [0:1]={bit,bit}
!  bitne          | boolean    | [0:1]={bit,bit}
!  booleq         | boolean    | [0:1]={boolean,boolean}
!  boolge         | boolean    | [0:1]={boolean,boolean}
!  boolgt         | boolean    | [0:1]={boolean,boolean}
!  boolle         | boolean    | [0:1]={boolean,boolean}
!  boollt         | boolean    | [0:1]={boolean,boolean}
!  boolne         | boolean    | [0:1]={boolean,boolean}
!  bpchareq       | boolean    | [0:1]={character,character}
!  bpcharne       | boolean    | [0:1]={character,character}
!  byteaeq        | boolean    | [0:1]={bytea,bytea}
!  byteage        | boolean    | [0:1]={bytea,bytea}
!  byteagt        | boolean    | [0:1]={bytea,bytea}
!  byteale        | boolean    | [0:1]={bytea,bytea}
!  bytealt        | boolean    | [0:1]={bytea,bytea}
!  byteane        | boolean    | [0:1]={bytea,bytea}
!  cash_eq        | boolean    | [0:1]={money,money}
!  cash_ge        | boolean    | [0:1]={money,money}
!  cash_gt        | boolean    | [0:1]={money,money}
!  cash_le        | boolean    | [0:1]={money,money}
!  cash_lt        | boolean    | [0:1]={money,money}
!  cash_ne        | boolean    | [0:1]={money,money}
!  chareq         | boolean    | [0:1]={"\"char\"","\"char\""}
!  charge         | boolean    | [0:1]={"\"char\"","\"char\""}
!  chargt         | boolean    | [0:1]={"\"char\"","\"char\""}
!  charle         | boolean    | [0:1]={"\"char\"","\"char\""}
!  charlt         | boolean    | [0:1]={"\"char\"","\"char\""}
!  charne         | boolean    | [0:1]={"\"char\"","\"char\""}
!  cideq          | boolean    | [0:1]={cid,cid}
!  circle_eq      | boolean    | [0:1]={circle,circle}
!  circle_ge      | boolean    | [0:1]={circle,circle}
!  circle_gt      | boolean    | [0:1]={circle,circle}
!  circle_le      | boolean    | [0:1]={circle,circle}
!  circle_lt      | boolean    | [0:1]={circle,circle}
!  circle_ne      | boolean    | [0:1]={circle,circle}
!  date_eq        | boolean    | [0:1]={date,date}
!  date_ge        | boolean    | [0:1]={date,date}
!  date_gt        | boolean    | [0:1]={date,date}
!  date_le        | boolean    | [0:1]={date,date}
!  date_lt        | boolean    | [0:1]={date,date}
!  date_ne        | boolean    | [0:1]={date,date}
!  float48eq      | boolean    | [0:1]={real,"double precision"}
!  float48ge      | boolean    | [0:1]={real,"double precision"}
!  float48gt      | boolean    | [0:1]={real,"double precision"}
!  float48le      | boolean    | [0:1]={real,"double precision"}
!  float48lt      | boolean    | [0:1]={real,"double precision"}
!  float48ne      | boolean    | [0:1]={real,"double precision"}
!  float4eq       | boolean    | [0:1]={real,real}
!  float4ge       | boolean    | [0:1]={real,real}
!  float4gt       | boolean    | [0:1]={real,real}
!  float4le       | boolean    | [0:1]={real,real}
!  float4lt       | boolean    | [0:1]={real,real}
!  float4ne       | boolean    | [0:1]={real,real}
!  float84eq      | boolean    | [0:1]={"double precision",real}
!  float84ge      | boolean    | [0:1]={"double precision",real}
!  float84gt      | boolean    | [0:1]={"double precision",real}
!  float84le      | boolean    | [0:1]={"double precision",real}
!  float84lt      | boolean    | [0:1]={"double precision",real}
!  float84ne      | boolean    | [0:1]={"double precision",real}
!  float8eq       | boolean    | [0:1]={"double precision","double precision"}
!  float8ge       | boolean    | [0:1]={"double precision","double precision"}
!  float8gt       | boolean    | [0:1]={"double precision","double precision"}
!  float8le       | boolean    | [0:1]={"double precision","double precision"}
!  float8lt       | boolean    | [0:1]={"double precision","double precision"}
!  float8ne       | boolean    | [0:1]={"double precision","double precision"}
!  int24eq        | boolean    | [0:1]={smallint,integer}
!  int24ge        | boolean    | [0:1]={smallint,integer}
!  int24gt        | boolean    | [0:1]={smallint,integer}
!  int24le        | boolean    | [0:1]={smallint,integer}
!  int24lt        | boolean    | [0:1]={smallint,integer}
!  int24ne        | boolean    | [0:1]={smallint,integer}
!  int28eq        | boolean    | [0:1]={smallint,bigint}
!  int28ge        | boolean    | [0:1]={smallint,bigint}
!  int28gt        | boolean    | [0:1]={smallint,bigint}
!  int28le        | boolean    | [0:1]={smallint,bigint}
!  int28lt        | boolean    | [0:1]={smallint,bigint}
!  int28ne        | boolean    | [0:1]={smallint,bigint}
!  int2eq         | boolean    | [0:1]={smallint,smallint}
!  int2ge         | boolean    | [0:1]={smallint,smallint}
!  int2gt         | boolean    | [0:1]={smallint,smallint}
!  int2le         | boolean    | [0:1]={smallint,smallint}
!  int2lt         | boolean    | [0:1]={smallint,smallint}
!  int2ne         | boolean    | [0:1]={smallint,smallint}
!  int42eq        | boolean    | [0:1]={integer,smallint}
!  int42ge        | boolean    | [0:1]={integer,smallint}
!  int42gt        | boolean    | [0:1]={integer,smallint}
!  int42le        | boolean    | [0:1]={integer,smallint}
!  int42lt        | boolean    | [0:1]={integer,smallint}
!  int42ne        | boolean    | [0:1]={integer,smallint}
!  int48eq        | boolean    | [0:1]={integer,bigint}
!  int48ge        | boolean    | [0:1]={integer,bigint}
!  int48gt        | boolean    | [0:1]={integer,bigint}
!  int48le        | boolean    | [0:1]={integer,bigint}
!  int48lt        | boolean    | [0:1]={integer,bigint}
!  int48ne        | boolean    | [0:1]={integer,bigint}
!  int4eq         | boolean    | [0:1]={integer,integer}
!  int4ge         | boolean    | [0:1]={integer,integer}
!  int4gt         | boolean    | [0:1]={integer,integer}
!  int4le         | boolean    | [0:1]={integer,integer}
!  int4lt         | boolean    | [0:1]={integer,integer}
!  int4ne         | boolean    | [0:1]={integer,integer}
!  int82eq        | boolean    | [0:1]={bigint,smallint}
!  int82ge        | boolean    | [0:1]={bigint,smallint}
!  int82gt        | boolean    | [0:1]={bigint,smallint}
!  int82le        | boolean    | [0:1]={bigint,smallint}
!  int82lt        | boolean    | [0:1]={bigint,smallint}
!  int82ne        | boolean    | [0:1]={bigint,smallint}
!  int84eq        | boolean    | [0:1]={bigint,integer}
!  int84ge        | boolean    | [0:1]={bigint,integer}
!  int84gt        | boolean    | [0:1]={bigint,integer}
!  int84le        | boolean    | [0:1]={bigint,integer}
!  int84lt        | boolean    | [0:1]={bigint,integer}
!  int84ne        | boolean    | [0:1]={bigint,integer}
!  int8eq         | boolean    | [0:1]={bigint,bigint}
!  int8ge         | boolean    | [0:1]={bigint,bigint}
!  int8gt         | boolean    | [0:1]={bigint,bigint}
!  int8le         | boolean    | [0:1]={bigint,bigint}
!  int8lt         | boolean    | [0:1]={bigint,bigint}
!  int8ne         | boolean    | [0:1]={bigint,bigint}
!  interval_eq    | boolean    | [0:1]={interval,interval}
!  interval_ge    | boolean    | [0:1]={interval,interval}
!  interval_gt    | boolean    | [0:1]={interval,interval}
!  interval_le    | boolean    | [0:1]={interval,interval}
!  interval_lt    | boolean    | [0:1]={interval,interval}
!  interval_ne    | boolean    | [0:1]={interval,interval}
!  lseg_eq        | boolean    | [0:1]={lseg,lseg}
!  lseg_ge        | boolean    | [0:1]={lseg,lseg}
!  lseg_gt        | boolean    | [0:1]={lseg,lseg}
!  lseg_le        | boolean    | [0:1]={lseg,lseg}
!  lseg_lt        | boolean    | [0:1]={lseg,lseg}
!  lseg_ne        | boolean    | [0:1]={lseg,lseg}
!  macaddr_eq     | boolean    | [0:1]={macaddr,macaddr}
!  macaddr_ge     | boolean    | [0:1]={macaddr,macaddr}
!  macaddr_gt     | boolean    | [0:1]={macaddr,macaddr}
!  macaddr_le     | boolean    | [0:1]={macaddr,macaddr}
!  macaddr_lt     | boolean    | [0:1]={macaddr,macaddr}
!  macaddr_ne     | boolean    | [0:1]={macaddr,macaddr}
!  nameeq         | boolean    | [0:1]={name,name}
!  namege         | boolean    | [0:1]={name,name}
!  namegt         | boolean    | [0:1]={name,name}
!  namele         | boolean    | [0:1]={name,name}
!  namelt         | boolean    | [0:1]={name,name}
!  namene         | boolean    | [0:1]={name,name}
!  network_eq     | boolean    | [0:1]={inet,inet}
!  network_ge     | boolean    | [0:1]={inet,inet}
!  network_gt     | boolean    | [0:1]={inet,inet}
!  network_le     | boolean    | [0:1]={inet,inet}
!  network_lt     | boolean    | [0:1]={inet,inet}
!  network_ne     | boolean    | [0:1]={inet,inet}
!  oideq          | boolean    | [0:1]={oid,oid}
!  oidge          | boolean    | [0:1]={oid,oid}
!  oidgt          | boolean    | [0:1]={oid,oid}
!  oidle          | boolean    | [0:1]={oid,oid}
!  oidlt          | boolean    | [0:1]={oid,oid}
!  oidne          | boolean    | [0:1]={oid,oid}
!  reltimeeq      | boolean    | [0:1]={reltime,reltime}
!  reltimege      | boolean    | [0:1]={reltime,reltime}
!  reltimegt      | boolean    | [0:1]={reltime,reltime}
!  reltimele      | boolean    | [0:1]={reltime,reltime}
!  reltimelt      | boolean    | [0:1]={reltime,reltime}
!  reltimene      | boolean    | [0:1]={reltime,reltime}
!  texteq         | boolean    | [0:1]={text,text}
!  textne         | boolean    | [0:1]={text,text}
!  tideq          | boolean    | [0:1]={tid,tid}
!  tidge          | boolean    | [0:1]={tid,tid}
!  tidgt          | boolean    | [0:1]={tid,tid}
!  tidle          | boolean    | [0:1]={tid,tid}
!  tidlt          | boolean    | [0:1]={tid,tid}
!  tidne          | boolean    | [0:1]={tid,tid}
!  time_eq        | boolean    | [0:1]={"time without time zone","time without time zone"}
!  time_ge        | boolean    | [0:1]={"time without time zone","time without time zone"}
!  time_gt        | boolean    | [0:1]={"time without time zone","time without time zone"}
!  time_le        | boolean    | [0:1]={"time without time zone","time without time zone"}
!  time_lt        | boolean    | [0:1]={"time without time zone","time without time zone"}
!  time_ne        | boolean    | [0:1]={"time without time zone","time without time zone"}
!  timestamp_eq   | boolean    | [0:1]={"timestamp without time zone","timestamp without time zone"}
!  timestamp_ge   | boolean    | [0:1]={"timestamp without time zone","timestamp without time zone"}
!  timestamp_gt   | boolean    | [0:1]={"timestamp without time zone","timestamp without time zone"}
!  timestamp_le   | boolean    | [0:1]={"timestamp without time zone","timestamp without time zone"}
!  timestamp_lt   | boolean    | [0:1]={"timestamp without time zone","timestamp without time zone"}
!  timestamp_ne   | boolean    | [0:1]={"timestamp without time zone","timestamp without time zone"}
!  timestamptz_eq | boolean    | [0:1]={"timestamp with time zone","timestamp with time zone"}
!  timestamptz_ge | boolean    | [0:1]={"timestamp with time zone","timestamp with time zone"}
!  timestamptz_gt | boolean    | [0:1]={"timestamp with time zone","timestamp with time zone"}
!  timestamptz_le | boolean    | [0:1]={"timestamp with time zone","timestamp with time zone"}
!  timestamptz_lt | boolean    | [0:1]={"timestamp with time zone","timestamp with time zone"}
!  timestamptz_ne | boolean    | [0:1]={"timestamp with time zone","timestamp with time zone"}
!  timetz_eq      | boolean    | [0:1]={"time with time zone","time with time zone"}
!  timetz_ge      | boolean    | [0:1]={"time with time zone","time with time zone"}
!  timetz_gt      | boolean    | [0:1]={"time with time zone","time with time zone"}
!  timetz_le      | boolean    | [0:1]={"time with time zone","time with time zone"}
!  timetz_lt      | boolean    | [0:1]={"time with time zone","time with time zone"}
!  timetz_ne      | boolean    | [0:1]={"time with time zone","time with time zone"}
!  tintervaleq    | boolean    | [0:1]={tinterval,tinterval}
!  tintervalge    | boolean    | [0:1]={tinterval,tinterval}
!  tintervalgt    | boolean    | [0:1]={tinterval,tinterval}
!  tintervalle    | boolean    | [0:1]={tinterval,tinterval}
!  tintervalleneq | boolean    | [0:1]={tinterval,reltime}
!  tintervallenge | boolean    | [0:1]={tinterval,reltime}
!  tintervallengt | boolean    | [0:1]={tinterval,reltime}
!  tintervallenle | boolean    | [0:1]={tinterval,reltime}
!  tintervallenlt | boolean    | [0:1]={tinterval,reltime}
!  tintervallenne | boolean    | [0:1]={tinterval,reltime}
!  tintervallt    | boolean    | [0:1]={tinterval,tinterval}
!  tintervalne    | boolean    | [0:1]={tinterval,tinterval}
!  uuid_eq        | boolean    | [0:1]={uuid,uuid}
!  uuid_ge        | boolean    | [0:1]={uuid,uuid}
!  uuid_gt        | boolean    | [0:1]={uuid,uuid}
!  uuid_le        | boolean    | [0:1]={uuid,uuid}
!  uuid_lt        | boolean    | [0:1]={uuid,uuid}
!  uuid_ne        | boolean    | [0:1]={uuid,uuid}
!  varbiteq       | boolean    | [0:1]={"bit varying","bit varying"}
!  varbitge       | boolean    | [0:1]={"bit varying","bit varying"}
!  varbitgt       | boolean    | [0:1]={"bit varying","bit varying"}
!  varbitle       | boolean    | [0:1]={"bit varying","bit varying"}
!  varbitlt       | boolean    | [0:1]={"bit varying","bit varying"}
!  varbitne       | boolean    | [0:1]={"bit varying","bit varying"}
!  xideq          | boolean    | [0:1]={xid,xid}
! (228 rows)
  
  --
  -- CALLED ON NULL INPUT | RETURNS NULL ON NULL INPUT | STRICT
--- 153,391 ----
  SELECT proname, prorettype::regtype, proargtypes::regtype[]
         FROM pg_proc JOIN pg_namespace ON pronamespace = pg_namespace.oid
         WHERE nspname = 'pg_catalog' AND proleakproof ORDER BY proname;
!      proname     | prorettype |                             proargtypes                             
! -----------------+------------+---------------------------------------------------------------------
!  abstimeeq       | boolean    | [0:1]={abstime,abstime}
!  abstimege       | boolean    | [0:1]={abstime,abstime}
!  abstimegt       | boolean    | [0:1]={abstime,abstime}
!  abstimele       | boolean    | [0:1]={abstime,abstime}
!  abstimelt       | boolean    | [0:1]={abstime,abstime}
!  abstimene       | boolean    | [0:1]={abstime,abstime}
!  biteq           | boolean    | [0:1]={bit,bit}
!  bitge           | boolean    | [0:1]={bit,bit}
!  bitgt           | boolean    | [0:1]={bit,bit}
!  bitle           | boolean    | [0:1]={bit,bit}
!  bitlt           | boolean    | [0:1]={bit,bit}
!  bitne           | boolean    | [0:1]={bit,bit}
!  booleq          | boolean    | [0:1]={boolean,boolean}
!  boolge          | boolean    | [0:1]={boolean,boolean}
!  boolgt          | boolean    | [0:1]={boolean,boolean}
!  boolle          | boolean    | [0:1]={boolean,boolean}
!  boollt          | boolean    | [0:1]={boolean,boolean}
!  boolne          | boolean    | [0:1]={boolean,boolean}
!  bpchareq        | boolean    | [0:1]={character,character}
!  bpcharne        | boolean    | [0:1]={character,character}
!  byteaeq         | boolean    | [0:1]={bytea,bytea}
!  byteage         | boolean    | [0:1]={bytea,bytea}
!  byteagt         | boolean    | [0:1]={bytea,bytea}
!  byteale         | boolean    | [0:1]={bytea,bytea}
!  bytealt         | boolean    | [0:1]={bytea,bytea}
!  byteane         | boolean    | [0:1]={bytea,bytea}
!  cash_eq         | boolean    | [0:1]={money,money}
!  cash_ge         | boolean    | [0:1]={money,money}
!  cash_gt         | boolean    | [0:1]={money,money}
!  cash_le         | boolean    | [0:1]={money,money}
!  cash_lt         | boolean    | [0:1]={money,money}
!  cash_ne         | boolean    | [0:1]={money,money}
!  chareq          | boolean    | [0:1]={"\"char\"","\"char\""}
!  charge          | boolean    | [0:1]={"\"char\"","\"char\""}
!  chargt          | boolean    | [0:1]={"\"char\"","\"char\""}
!  charle          | boolean    | [0:1]={"\"char\"","\"char\""}
!  charlt          | boolean    | [0:1]={"\"char\"","\"char\""}
!  charne          | boolean    | [0:1]={"\"char\"","\"char\""}
!  cideq           | boolean    | [0:1]={cid,cid}
!  circle_eq       | boolean    | [0:1]={circle,circle}
!  circle_ge       | boolean    | [0:1]={circle,circle}
!  circle_gt       | boolean    | [0:1]={circle,circle}
!  circle_le       | boolean    | [0:1]={circle,circle}
!  circle_lt       | boolean    | [0:1]={circle,circle}
!  circle_ne       | boolean    | [0:1]={circle,circle}
!  date_eq         | boolean    | [0:1]={date,date}
!  date_ge         | boolean    | [0:1]={date,date}
!  date_gt         | boolean    | [0:1]={date,date}
!  date_le         | boolean    | [0:1]={date,date}
!  date_lt         | boolean    | [0:1]={date,date}
!  date_ne         | boolean    | [0:1]={date,date}
!  float48eq       | boolean    | [0:1]={real,"double precision"}
!  float48ge       | boolean    | [0:1]={real,"double precision"}
!  float48gt       | boolean    | [0:1]={real,"double precision"}
!  float48le       | boolean    | [0:1]={real,"double precision"}
!  float48lt       | boolean    | [0:1]={real,"double precision"}
!  float48ne       | boolean    | [0:1]={real,"double precision"}
!  float4eq        | boolean    | [0:1]={real,real}
!  float4ge        | boolean    | [0:1]={real,real}
!  float4gt        | boolean    | [0:1]={real,real}
!  float4le        | boolean    | [0:1]={real,real}
!  float4lt        | boolean    | [0:1]={real,real}
!  float4ne        | boolean    | [0:1]={real,real}
!  float84eq       | boolean    | [0:1]={"double precision",real}
!  float84ge       | boolean    | [0:1]={"double precision",real}
!  float84gt       | boolean    | [0:1]={"double precision",real}
!  float84le       | boolean    | [0:1]={"double precision",real}
!  float84lt       | boolean    | [0:1]={"double precision",real}
!  float84ne       | boolean    | [0:1]={"double precision",real}
!  float8eq        | boolean    | [0:1]={"double precision","double precision"}
!  float8ge        | boolean    | [0:1]={"double precision","double precision"}
!  float8gt        | boolean    | [0:1]={"double precision","double precision"}
!  float8le        | boolean    | [0:1]={"double precision","double precision"}
!  float8lt        | boolean    | [0:1]={"double precision","double precision"}
!  float8ne        | boolean    | [0:1]={"double precision","double precision"}
!  int24eq         | boolean    | [0:1]={smallint,integer}
!  int24ge         | boolean    | [0:1]={smallint,integer}
!  int24gt         | boolean    | [0:1]={smallint,integer}
!  int24le         | boolean    | [0:1]={smallint,integer}
!  int24lt         | boolean    | [0:1]={smallint,integer}
!  int24ne         | boolean    | [0:1]={smallint,integer}
!  int28eq         | boolean    | [0:1]={smallint,bigint}
!  int28ge         | boolean    | [0:1]={smallint,bigint}
!  int28gt         | boolean    | [0:1]={smallint,bigint}
!  int28le         | boolean    | [0:1]={smallint,bigint}
!  int28lt         | boolean    | [0:1]={smallint,bigint}
!  int28ne         | boolean    | [0:1]={smallint,bigint}
!  int2eq          | boolean    | [0:1]={smallint,smallint}
!  int2ge          | boolean    | [0:1]={smallint,smallint}
!  int2gt          | boolean    | [0:1]={smallint,smallint}
!  int2le          | boolean    | [0:1]={smallint,smallint}
!  int2lt          | boolean    | [0:1]={smallint,smallint}
!  int2ne          | boolean    | [0:1]={smallint,smallint}
!  int42eq         | boolean    | [0:1]={integer,smallint}
!  int42ge         | boolean    | [0:1]={integer,smallint}
!  int42gt         | boolean    | [0:1]={integer,smallint}
!  int42le         | boolean    | [0:1]={integer,smallint}
!  int42lt         | boolean    | [0:1]={integer,smallint}
!  int42ne         | boolean    | [0:1]={integer,smallint}
!  int48eq         | boolean    | [0:1]={integer,bigint}
!  int48ge         | boolean    | [0:1]={integer,bigint}
!  int48gt         | boolean    | [0:1]={integer,bigint}
!  int48le         | boolean    | [0:1]={integer,bigint}
!  int48lt         | boolean    | [0:1]={integer,bigint}
!  int48ne         | boolean    | [0:1]={integer,bigint}
!  int4eq          | boolean    | [0:1]={integer,integer}
!  int4ge          | boolean    | [0:1]={integer,integer}
!  int4gt          | boolean    | [0:1]={integer,integer}
!  int4le          | boolean    | [0:1]={integer,integer}
!  int4lt          | boolean    | [0:1]={integer,integer}
!  int4ne          | boolean    | [0:1]={integer,integer}
!  int82eq         | boolean    | [0:1]={bigint,smallint}
!  int82ge         | boolean    | [0:1]={bigint,smallint}
!  int82gt         | boolean    | [0:1]={bigint,smallint}
!  int82le         | boolean    | [0:1]={bigint,smallint}
!  int82lt         | boolean    | [0:1]={bigint,smallint}
!  int82ne         | boolean    | [0:1]={bigint,smallint}
!  int84eq         | boolean    | [0:1]={bigint,integer}
!  int84ge         | boolean    | [0:1]={bigint,integer}
!  int84gt         | boolean    | [0:1]={bigint,integer}
!  int84le         | boolean    | [0:1]={bigint,integer}
!  int84lt         | boolean    | [0:1]={bigint,integer}
!  int84ne         | boolean    | [0:1]={bigint,integer}
!  int8eq          | boolean    | [0:1]={bigint,bigint}
!  int8ge          | boolean    | [0:1]={bigint,bigint}
!  int8gt          | boolean    | [0:1]={bigint,bigint}
!  int8le          | boolean    | [0:1]={bigint,bigint}
!  int8lt          | boolean    | [0:1]={bigint,bigint}
!  int8ne          | boolean    | [0:1]={bigint,bigint}
!  interval_eq     | boolean    | [0:1]={interval,interval}
!  interval_ge     | boolean    | [0:1]={interval,interval}
!  interval_gt     | boolean    | [0:1]={interval,interval}
!  interval_le     | boolean    | [0:1]={interval,interval}
!  interval_lt     | boolean    | [0:1]={interval,interval}
!  interval_ne     | boolean    | [0:1]={interval,interval}
!  lseg_eq         | boolean    | [0:1]={lseg,lseg}
!  lseg_ge         | boolean    | [0:1]={lseg,lseg}
!  lseg_gt         | boolean    | [0:1]={lseg,lseg}
!  lseg_le         | boolean    | [0:1]={lseg,lseg}
!  lseg_lt         | boolean    | [0:1]={lseg,lseg}
!  lseg_ne         | boolean    | [0:1]={lseg,lseg}
!  macaddr_eq      | boolean    | [0:1]={macaddr,macaddr}
!  macaddr_ge      | boolean    | [0:1]={macaddr,macaddr}
!  macaddr_gt      | boolean    | [0:1]={macaddr,macaddr}
!  macaddr_le      | boolean    | [0:1]={macaddr,macaddr}
!  macaddr_lt      | boolean    | [0:1]={macaddr,macaddr}
!  macaddr_ne      | boolean    | [0:1]={macaddr,macaddr}
!  nameeq          | boolean    | [0:1]={name,name}
!  namege          | boolean    | [0:1]={name,name}
!  namegt          | boolean    | [0:1]={name,name}
!  namele          | boolean    | [0:1]={name,name}
!  namelt          | boolean    | [0:1]={name,name}
!  namene          | boolean    | [0:1]={name,name}
!  network_eq      | boolean    | [0:1]={inet,inet}
!  network_ge      | boolean    | [0:1]={inet,inet}
!  network_gt      | boolean    | [0:1]={inet,inet}
!  network_larger  | inet       | [0:1]={inet,inet}
!  network_le      | boolean    | [0:1]={inet,inet}
!  network_lt      | boolean    | [0:1]={inet,inet}
!  network_ne      | boolean    | [0:1]={inet,inet}
!  network_smaller | inet       | [0:1]={inet,inet}
!  oideq           | boolean    | [0:1]={oid,oid}
!  oidge           | boolean    | [0:1]={oid,oid}
!  oidgt           | boolean    | [0:1]={oid,oid}
!  oidle           | boolean    | [0:1]={oid,oid}
!  oidlt           | boolean    | [0:1]={oid,oid}
!  oidne           | boolean    | [0:1]={oid,oid}
!  reltimeeq       | boolean    | [0:1]={reltime,reltime}
!  reltimege       | boolean    | [0:1]={reltime,reltime}
!  reltimegt       | boolean    | [0:1]={reltime,reltime}
!  reltimele       | boolean    | [0:1]={reltime,reltime}
!  reltimelt       | boolean    | [0:1]={reltime,reltime}
!  reltimene       | boolean    | [0:1]={reltime,reltime}
!  texteq          | boolean    | [0:1]={text,text}
!  textne          | boolean    | [0:1]={text,text}
!  tideq           | boolean    | [0:1]={tid,tid}
!  tidge           | boolean    | [0:1]={tid,tid}
!  tidgt           | boolean    | [0:1]={tid,tid}
!  tidle           | boolean    | [0:1]={tid,tid}
!  tidlt           | boolean    | [0:1]={tid,tid}
!  tidne           | boolean    | [0:1]={tid,tid}
!  time_eq         | boolean    | [0:1]={"time without time zone","time without time zone"}
!  time_ge         | boolean    | [0:1]={"time without time zone","time without time zone"}
!  time_gt         | boolean    | [0:1]={"time without time zone","time without time zone"}
!  time_le         | boolean    | [0:1]={"time without time zone","time without time zone"}
!  time_lt         | boolean    | [0:1]={"time without time zone","time without time zone"}
!  time_ne         | boolean    | [0:1]={"time without time zone","time without time zone"}
!  timestamp_eq    | boolean    | [0:1]={"timestamp without time zone","timestamp without time zone"}
!  timestamp_ge    | boolean    | [0:1]={"timestamp without time zone","timestamp without time zone"}
!  timestamp_gt    | boolean    | [0:1]={"timestamp without time zone","timestamp without time zone"}
!  timestamp_le    | boolean    | [0:1]={"timestamp without time zone","timestamp without time zone"}
!  timestamp_lt    | boolean    | [0:1]={"timestamp without time zone","timestamp without time zone"}
!  timestamp_ne    | boolean    | [0:1]={"timestamp without time zone","timestamp without time zone"}
!  timestamptz_eq  | boolean    | [0:1]={"timestamp with time zone","timestamp with time zone"}
!  timestamptz_ge  | boolean    | [0:1]={"timestamp with time zone","timestamp with time zone"}
!  timestamptz_gt  | boolean    | [0:1]={"timestamp with time zone","timestamp with time zone"}
!  timestamptz_le  | boolean    | [0:1]={"timestamp with time zone","timestamp with time zone"}
!  timestamptz_lt  | boolean    | [0:1]={"timestamp with time zone","timestamp with time zone"}
!  timestamptz_ne  | boolean    | [0:1]={"timestamp with time zone","timestamp with time zone"}
!  timetz_eq       | boolean    | [0:1]={"time with time zone","time with time zone"}
!  timetz_ge       | boolean    | [0:1]={"time with time zone","time with time zone"}
!  timetz_gt       | boolean    | [0:1]={"time with time zone","time with time zone"}
!  timetz_le       | boolean    | [0:1]={"time with time zone","time with time zone"}
!  timetz_lt       | boolean    | [0:1]={"time with time zone","time with time zone"}
!  timetz_ne       | boolean    | [0:1]={"time with time zone","time with time zone"}
!  tintervaleq     | boolean    | [0:1]={tinterval,tinterval}
!  tintervalge     | boolean    | [0:1]={tinterval,tinterval}
!  tintervalgt     | boolean    | [0:1]={tinterval,tinterval}
!  tintervalle     | boolean    | [0:1]={tinterval,tinterval}
!  tintervalleneq  | boolean    | [0:1]={tinterval,reltime}
!  tintervallenge  | boolean    | [0:1]={tinterval,reltime}
!  tintervallengt  | boolean    | [0:1]={tinterval,reltime}
!  tintervallenle  | boolean    | [0:1]={tinterval,reltime}
!  tintervallenlt  | boolean    | [0:1]={tinterval,reltime}
!  tintervallenne  | boolean    | [0:1]={tinterval,reltime}
!  tintervallt     | boolean    | [0:1]={tinterval,tinterval}
!  tintervalne     | boolean    | [0:1]={tinterval,tinterval}
!  uuid_eq         | boolean    | [0:1]={uuid,uuid}
!  uuid_ge         | boolean    | [0:1]={uuid,uuid}
!  uuid_gt         | boolean    | [0:1]={uuid,uuid}
!  uuid_le         | boolean    | [0:1]={uuid,uuid}
!  uuid_lt         | boolean    | [0:1]={uuid,uuid}
!  uuid_ne         | boolean    | [0:1]={uuid,uuid}
!  varbiteq        | boolean    | [0:1]={"bit varying","bit varying"}
!  varbitge        | boolean    | [0:1]={"bit varying","bit varying"}
!  varbitgt        | boolean    | [0:1]={"bit varying","bit varying"}
!  varbitle        | boolean    | [0:1]={"bit varying","bit varying"}
!  varbitlt        | boolean    | [0:1]={"bit varying","bit varying"}
!  varbitne        | boolean    | [0:1]={"bit varying","bit varying"}
!  xideq           | boolean    | [0:1]={xid,xid}
! (230 rows)
  
  --
  -- CALLED ON NULL INPUT | RETURNS NULL ON NULL INPUT | STRICT
*** a/src/test/regress/expected/inet.out
--- b/src/test/regress/expected/inet.out
***************
*** 204,209 **** SELECT '' AS ten, i, c,
--- 204,215 ----
       | ::4.3.2.1/24     | ::ffff:1.2.3.4/128 | t  | t  | f  | f  | f  | t  | f  | f   | t   | t   | t
  (17 rows)
  
+ SELECT max(i) as max, min(i) as min FROM INET_TBL;
+      max     |    min    
+ -------------+-----------
+  10:23::ffff | 9.1.2.3/8
+ (1 row)
+ 
  -- check the conversion to/from text and set_netmask
  SELECT '' AS ten, set_masklen(inet(text(i)), 24) FROM INET_TBL;
   ten |   set_masklen    
*** a/src/test/regress/sql/inet.sql
--- b/src/test/regress/sql/inet.sql
***************
*** 56,61 **** SELECT '' AS ten, i, c,
--- 56,63 ----
    i && c AS ovr
    FROM INET_TBL;
  
+ SELECT max(i) as max, min(i) as min FROM INET_TBL;
+ 
  -- check the conversion to/from text and set_netmask
  SELECT '' AS ten, set_masklen(inet(text(i)), 24) FROM INET_TBL;
  
