Some more function-default issues
От | Tom Lane |
---|---|
Тема | Some more function-default issues |
Дата | |
Msg-id | 7958.1231248764@sss.pgh.pa.us обсуждение исходный текст |
Ответы |
Re: Some more function-default issues
|
Список | pgsql-hackers |
Some further reflection about Rushabh Lathia's bug report of yesterday led me to the realization that there's a pretty big hole in the function defaults patch. Since we add default values during planning, it doesn't work for any expression that's not fed through the planner. For instance, ALTER COLUMN USING: regression=# create function add(int, int = 42) returns int regression-# as 'select $1+$2' language sql; CREATE FUNCTION regression=# create table foo(f1 int); CREATE TABLE regression=# insert into foo values (1); INSERT 0 1 regression=# alter table foo alter column f1 type bigint using add(f1)::bigint; ERROR: no value found for parameter 2 CONTEXT: SQL function "add" statement 1 The minimum-code-change solution would be to run around and try to make sure every such expression gets passed through eval_const_expressions() before we try to execute it. This is probably doable (looking for calls to fix_opfuncids would be a good guide) but it seems like the potential for errors of omission is large, particularly in third-party add-ons. I wonder if anyone has an idea for a better way to attack this? regards, tom lane
В списке pgsql-hackers по дате отправления: