pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: hu_yajun@qq.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #17936: Memory Leak when OPERATOR FAMILY use LANGUAGE SQL function
Date: Tue, 16 May 2023 09:52:08 -0400
Message-ID: <2591314.1684245128@sss.pgh.pa.us> (raw)
In-Reply-To: <17936-ccbf22f31c04b6cf@postgresql.org>
References: <17936-ccbf22f31c04b6cf@postgresql.org>

PG Bug reporting form <noreply@postgresql.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





view thread (2+ messages)

Message-ID: <2591314.1684245128@sss.pgh.pa.us>
Permalink:  ../2591314.1684245128@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/2591314.1684245128@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, hu_yajun@qq.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #17936: Memory Leak when OPERATOR FAMILY use LANGUAGE SQL function
  In-Reply-To: <2591314.1684245128@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox