From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | hu_yajun(at)qq(dot)com |
Cc: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
Subject: | Re: BUG #17936: Memory Leak when OPERATOR FAMILY use LANGUAGE SQL function |
Date: | 2023-05-16 13:52:08 |
Message-ID: | 2591314.1684245128@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
PG Bug reporting form <noreply(at)postgresql(dot)org> writes:
> I guess I found a memory leak problem when OPERATOR FAMILY use LANGUAGE
> SQL function.
> ** Problem **
> I build postgresql with tag REL_15_3, and run following SQL.
> --
> CREATE OR REPLACE FUNCTION pg_catalog.text_cmp_bpchar(text, bpchar)
> RETURNS int4
> AS'select pg_catalog.bttextcmp($1, $2::text)'
> LANGUAGE SQL IMMUTABLE STRICT PARALLEL SAFE;
> ALTER OPERATOR FAMILY text_ops USING btree ADD
> OPERATOR 3 =(bpchar, bpchar),
> FUNCTION 1 pg_catalog.text_cmp_bpchar(text, bpchar);
Don't do that. Btree expects comparison support functions not to leak
memory. There's zero interest in relaxing that requirement, and also
zero interest in making generic SQL-language functions meet it.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2023-05-16 14:23:03 | Re: BUG #17935: Incorrect memory access in fuzzystrmatch/difference() |
Previous Message | Daniel Gustafsson | 2023-05-16 13:31:42 | Re: Memory leak on subquery as scalar operand |