Re: When deleting the plpgsql function, release the CachedPlan of the function

Поиск
Список
Период
Сортировка
От 章晨曦
Тема Re: When deleting the plpgsql function, release the CachedPlan of the function
Дата
Msg-id tencent_1929C3EE7EE6304F36869112@qq.com
обсуждение исходный текст
Ответ на Re: When deleting the plpgsql function, release the CachedPlan of the function  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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...
Вложения

В списке pgsql-hackers по дате отправления: