question re internal functions requiring initdb

Поиск
Список
Период
Сортировка
От Joe Conway
Тема question re internal functions requiring initdb
Дата
Msg-id 3D30CADE.6020901@joeconway.com
обсуждение исходный текст
Ответы Re: question re internal functions requiring initdb  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
I was trying to see if it was possible to create an 'internal' function 
after bootstrap (i.e. without listing in pg_proc.h). The test case below 
illustrates that it is indeed possible.

test=# CREATE OR REPLACE FUNCTION mytest(text,int,int) RETURNS text AS 
'text_substr' LANGUAGE 'internal' IMMUTABLE STRICT;
CREATE FUNCTION
test=# select mytest('abcde',2,2); mytest
-------- bc
(1 row)

It made me wonder why don't we always create internal functions this 
way, or at least all except a core set of bootstrapped functions. Am I 
wrong in thinking that it would eliminate the need to initdb every time 
a new internal function is added?

We could have a script, say "internal_functions.sql", that would contain 
"CREATE OR REPLACE FUNCTION...LANGUAGE 'internal'..." for each internal 
function and be executed by initdb. When a new builtin function is added 
to the backend, you could run this script directly to update your catalog.

Just a thought. Any reason we can't or don't want to do this?

Joe



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

Предыдущее
От: "Groff, Dana"
Дата:
Сообщение: Re: Should this require CASCADE?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: question re internal functions requiring initdb