Is the subtype_diff function in CREATE TYPE only can be C function?

From: ddme <ret2ddme(at)qq(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Is the subtype_diff function in CREATE TYPE only can be C function?
Date: 2024-01-10 02:49:20
Message-ID: tencent_758B97399E4F02C35B6F3B90F2ABDC75A909@qq.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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!

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Sutou Kouhei 2024-01-10 03:00:34 Re: Make COPY format extendable: Extract COPY TO format implementations
Previous Message Tom Lane 2024-01-10 02:40:12 Re: pg_ctl start may return 0 even if the postmaster has been already started on Windows