Re: ALTER TYPE 3: add facility to identify further no-work cases

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: ALTER TYPE 3: add facility to identify further no-work cases
Дата
Msg-id 28474.1296084597@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: ALTER TYPE 3: add facility to identify further no-work cases  (Noah Misch <noah@leadboat.com>)
Ответы Re: ALTER TYPE 3: add facility to identify further no-work cases  (Noah Misch <noah@leadboat.com>)
Список pgsql-hackers
Noah Misch <noah@leadboat.com> writes:
> If we hook this into eval_const_expressions, it definitely seems
> cleaner to attach the auxiliary function to the pg_proc.  Otherwise,
> we'd reconstruct which cast led to each function call -- is there even
> enough information available to do so unambiguously?

As far as that goes, yes there is --- otherwise ruleutils would be
unable to reverse-list cast constructs.  IIRC the function call is
marked as being a cast, and you get the source and dest type IDs
from ordinary exprType() inspection.

> For the syntax, then, would a new common_func_opt_item of "WHEN func" fit?

WHEN is appropriate for the restricted CAST case, but it doesn't seem
like le mot juste for a general function option, unless we restrict
the helper function to return boolean which is not what I had in mind.

> That covers fully-removable casts, but ALTER TABLE still needs to identify casts
> that may throw errors but never change the value's binary representation.

I remain completely unexcited about optimizing that case, especially if
it doesn't fit into a general framework.  The bang for the buck ratio
is not good: too much work, too much uglification, too little return.
        regards, tom lane


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

Предыдущее
От: Jan Urbański
Дата:
Сообщение: Re: Re: [COMMITTERS] pgsql: Get rid of the global variable holding the error state
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: pl/python refactoring