Is the subtype_diff function in CREATE TYPE only can be C function? - Mailing list pgsql-hackers

From ddme
Subject Is the subtype_diff function in CREATE TYPE only can be C function?
Date
Msg-id tencent_758B97399E4F02C35B6F3B90F2ABDC75A909@qq.com
Whole thread Raw
Responses Re: Is the subtype_diff function in CREATE TYPE only can be C function?
List pgsql-hackers
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!

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: pg_ctl start may return 0 even if the postmaster has been already started on Windows
Next
From: Sutou Kouhei
Date:
Subject: Re: Make COPY format extendable: Extract COPY TO format implementations