From: | 章晨曦 <zhangchenxi(at)halodbtech(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | 曾满 <zengman(at)halodbtech(dot)com>, 陈天 <chentian(at)halodbtech(dot)com>, pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Vladlen Popolitov <v(dot)popolitov(at)postgrespro(dot)ru> |
Subject: | Re: When deleting the plpgsql function, release the CachedPlan of the function |
Date: | 2025-08-21 07:24:18 |
Message-ID: | tencent_1929C3EE7EE6304F36869112@qq.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
It seems not an easy task. And here is my new work of such task.
The main idea is register a sys cache callback in cached_function_compile
when not registered. So it will effect for all SPL.
And also introduce a new hash table to track the function for cache inval
callback. The procedure in callback to lookup for a function will be:
hashvalue
|
v
[lookup func_key_hashtable]
|
v
func_key
|
v
[lookup func_hashtable]
|
v
function
But still remain lots of work to consider. As we don't know what's the real
operation of this invalidation, that's may cause unnecessary deletion. e.g.
postgres=# create or replace function strtest() returns text as $$
postgres$# begin
postgres$# raise notice 'foo\\bar\041baz';
postgres$# return 'foo\\bar\041baz';
postgres$# end
postgres$# $$ language plpgsql;
WARNING: nonstandard use of \\ in a string literal
LINE 3: raise notice 'foo\\bar\041baz';
^
HINT: Use the escape string syntax for backslashes, e.g., E'\\'.
WARNING: nonstandard use of \\ in a string literal
LINE 4: return 'foo\\bar\041baz';
^
HINT: Use the escape string syntax for backslashes, e.g., E'\\'.
WARNING: nonstandard use of \\ in a string literal
LINE 4: return 'foo\\bar\041baz';
^
HINT: Use the escape string syntax for backslashes, e.g., E'\\'.
CREATE FUNCTION
postgres=# select strtest();
WARNING: nonstandard use of \\ in a string literal <--- redundant warning
HINT: Use the escape string syntax for backslashes, e.g., E'\\'.
WARNING: nonstandard use of \\ in a string literal
HINT: Use the escape string syntax for backslashes, e.g., E'\\'.
NOTICE: foo\bar!baz
WARNING: nonstandard use of \\ in a string literal
LINE 1: 'foo\\bar\041baz'
^
HINT: Use the escape string syntax for backslashes, e.g., E'\\'.
QUERY: 'foo\\bar\041baz'
strtest
-------------
foo\bar!baz
(1 row)
the function works no error, but cause deplicate warning message. i'm still working on this...
Attachment | Content-Type | Size |
---|---|---|
001_cleanup_spl_funccache_v1.patch | application/octet-stream | 5.3 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | kasaharatt | 2025-08-21 07:39:16 | Re: Add log_autovacuum_{vacuum|analyze}_min_duration |
Previous Message | Corey Huinker | 2025-08-21 07:19:40 | Re: vacuumdb --missing-stats-only and permission issue |