pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew Dunstan <andrew@dunslane.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Amul Sul <sulamul@gmail.com>
Cc: Andres Freund <andres@anarazel.de>
Cc: Alexander Korotkov <aekorotkov@gmail.com>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: David G. Johnston <david.g.johnston@gmail.com>
Cc: Corey Huinker <corey.huinker@gmail.com>
Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: Joe Conway <mail@joeconway.com>
Cc: Nikita Glukhov <n.gluhov@postgrespro.ru>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: Error-safe user functions
Date: Sat, 24 Dec 2022 15:23:38 -0500
Message-ID: <a0cb53c8-e68e-791b-a75e-6fc2ac7f36d8@dunslane.net> (raw)
In-Reply-To: <2911749.1671896555@sss.pgh.pa.us>
References: <4009543.1670422833@sss.pgh.pa.us>
	<01ff2051-806d-af2f-4f9e-793f7ba9a3f8@dunslane.net>
	<778369.1670598993@sss.pgh.pa.us>
	<5aaf7c66-9df9-21a9-1ff4-02c7848def52@dunslane.net>
	<3bac9841-fe07-713d-fa42-606c225567d6@dunslane.net>
	<1436686.1670701118@sss.pgh.pa.us>
	<2b1e7d56-6f37-bad9-9702-053ab55ecf60@dunslane.net>
	<1805344.1670779451@sss.pgh.pa.us>
	<b54e97be-7316-2cab-6969-bfac6ec88ca6@dunslane.net>
	<1863335.1670783397@sss.pgh.pa.us>
	<CAAJ_b951-kZ=FzWpU31A_Lb! j6foJmy852T3YeCT6sAqRbqLPWQ@mail.gmail.com>
	<CAAJ_b97KeDWUdpTKGOaFYPv0OicjOu6EW+QYWj-Ywrgj_aEy1g@mail.gmail.com>
	<2687377.1671033604@sss.pgh.pa.us>
	<be2bb! 2c4-d246-3cad-b969-7eba4c08336a@dunslane.net>
	<2966981.1671057469@sss.pgh.pa.us>
	<a! 8dc5700-c341-3ba8-0507-cc09881e6200@dunslane.net>
	<1964968.1671727440@sss.pgh.pa.us>
	<9c8f22f2-7a37-f! c4d-8e9f-3431c0d09c5a@dunslane.net>
	<2769684.1671821604@sss.pgh.pa.us>
	<d231804a-5306! -e2ce-f795-d243f0ebcd2c@dunslane.net>
	<2911749.1671896555@sss.pgh.pa.us>


On 2022-12-24 Sa 10:42, Tom Lane wrote:
> Andrew Dunstan <andrew@dunslane.net> writes:
>> As I was giving this a final polish I noticed this in jspConvertRegexFlags:
>>     /*
>>      * We'll never need sub-match details at execution.  While
>>      * RE_compile_and_execute would set this flag anyway, force it on here to
>>      * ensure that the regex cache entries created by makeItemLikeRegex are
>>      * useful.
>>      */
>>     cflags |= REG_NOSUB;
>> Clearly the comment would no longer be true. I guess I should just
>> remove this?
> Yeah, we can just drop that I guess.  I'm slightly worried that we might
> need it again after some future refactoring; but it's not really worth
> devising a re-worded comment to justify keeping it.
>
> Also, I realized that I failed in my reviewerly duty by not noticing
> that you'd forgotten to pg_regfree the regex after successful
> compilation.  Running something like this exposes the memory leak
> very quickly:
>
> select pg_input_is_valid('$ ? (@ like_regex "pattern" flag "smixq")', 'jsonpath')
>   from generate_series(1,10000000);
>
> The attached delta patch takes care of it.  (Per comment at pg_regcomp,
> we don't need this after a failure return.)
>
> 			


Thanks, pushed with those changes.


cheers


andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com






view thread (175+ messages)  latest in thread

Message-ID: <a0cb53c8-e68e-791b-a75e-6fc2ac7f36d8@dunslane.net>
Permalink:  ../a0cb53c8-e68e-791b-a75e-6fc2ac7f36d8@dunslane.net/
Also on:    postgresql.org/message-id/a0cb53c8-e68e-791b-a75e-6fc2ac7f36d8@dunslane.net

 · 

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-hackers@postgresql.org
  Cc: andrew@dunslane.net, tgl@sss.pgh.pa.us, sulamul@gmail.com, andres@anarazel.de, aekorotkov@gmail.com, robertmhaas@gmail.com, david.g.johnston@gmail.com, corey.huinker@gmail.com, alvherre@alvh.no-ip.org, mail@joeconway.com, n.gluhov@postgrespro.ru, pgsql-hackers@lists.postgresql.org
  Subject: Re: Error-safe user functions
  In-Reply-To: <a0cb53c8-e68e-791b-a75e-6fc2ac7f36d8@dunslane.net>

* 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