mirror of
https://github.com/postgres/postgres.git
synced 2025-11-07 19:06:32 +03:00
Add min and max aggregates for composite types (records).
Like min/max for arrays, these are just thin wrappers around the existing btree comparison function for records. Aleksander Alekseev Discussion: https://postgr.es/m/CAO=iB8L4WYSNxCJ8GURRjQsrXEQ2-zn3FiCsh2LMqvWq2WcONg@mail.gmail.com
This commit is contained in:
@@ -1315,6 +1315,24 @@ btrecordcmp(PG_FUNCTION_ARGS)
|
||||
PG_RETURN_INT32(record_cmp(fcinfo));
|
||||
}
|
||||
|
||||
Datum
|
||||
record_larger(PG_FUNCTION_ARGS)
|
||||
{
|
||||
if (record_cmp(fcinfo) > 0)
|
||||
PG_RETURN_DATUM(PG_GETARG_DATUM(0));
|
||||
else
|
||||
PG_RETURN_DATUM(PG_GETARG_DATUM(1));
|
||||
}
|
||||
|
||||
Datum
|
||||
record_smaller(PG_FUNCTION_ARGS)
|
||||
{
|
||||
if (record_cmp(fcinfo) < 0)
|
||||
PG_RETURN_DATUM(PG_GETARG_DATUM(0));
|
||||
else
|
||||
PG_RETURN_DATUM(PG_GETARG_DATUM(1));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* record_image_cmp :
|
||||
|
||||
Reference in New Issue
Block a user