Hi all,
I notice that the CREATE TYPE syntax can specify subtype_diff function
CREATE TYPE name
AS RANGE ( SUBTYPE = subtype
[ , SUBTYPE_OPCLASS = subtype_operator_class
] [ , COLLATION = collation
] [ , CANONICAL = canonical_function
] [ , SUBTYPE_DIFF = subtype_diff_function
] <————— here [ , MULTIRANGE_TYPE_NAME = multirange_type_name
]
)
And a example is
```sql
CREATE TYPE float8_range AS RANGE (subtype = float8, subtype_diff = float8mi);
```
I notice that float8mi is a C function, and I find the call_subtype_diff() in source code that it seems only can call C function.
I want to know
1. Can the subtype_diff function in CREATE TYPE be sql or plpgsql function?
2. How to call subtype_diff function? I know it related with GiST index, I need a example on how to trigger subtype_diff function.
What’s more, I want to learn how Postgres kernel call subtype_diff function (in which source file or function), that will help me a lot.
Thank you all!