Re: ALTER COLUMN ... SET EXPRESSION to alter stored generated column's expression

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: ALTER COLUMN ... SET EXPRESSION to alter stored generated column's expression
Дата
Msg-id e9ae99e2-1f99-43ab-b4e8-067a7aa581a0@eisentraut.org
обсуждение исходный текст
Ответ на Re: ALTER COLUMN ... SET EXPRESSION to alter stored generated column's expression  (Amul Sul <sulamul@gmail.com>)
Ответы Re: ALTER COLUMN ... SET EXPRESSION to alter stored generated column's expression
Список pgsql-hackers
On 15.11.23 13:26, Amul Sul wrote:
>     Question: Why are you using AT_PASS_ADD_OTHERCONSTR?  I don't know if
>     it's right or wrong, but if you have a specific reason, it would be
>     good
>     to know.
> 
> I referred to ALTER COLUMN DEFAULT and used that.

Hmm, I'm not sure if that is a good comparison.  For ALTER TABLE, SET 
DEFAULT is just a catalog manipulation, it doesn't change any data, so 
it's pretty easy.  SET EXPRESSION changes data, which other phases might 
want to inspect?  For example, if you do SET EXPRESSION and add a 
constraint in the same ALTER TABLE statement, do those run in the 
correct order?

>     I think ATExecSetExpression() needs to lock pg_attribute?  Did you lose
>     that during the refactoring?
> 
> I have removed that intentionally since we were not updating anything in
> pg_attribute like ALTER DROP EXPRESSION.

ok

>     Tiny comment: The error message in ATExecSetExpression() does not need
>     to mention "stored", since it would be also applicable to virtual
>     generated columns in the future.
> 
> I had to have the same thought, but later decided when we do that
> virtual column thing, we could simply change that. I am fine to do that 
> change
> now as well, let me know your thought.

Not a big deal, but I would change it now.

Another small thing I found:  In ATExecColumnDefault(), there is an 
errhint() that suggests DROP EXPRESSION instead of DROP DEFAULT.  You 
could now add another hint that suggests SET EXPRESSION instead of SET 
DEFAULT.




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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: On non-Windows, hard depend on uselocale(3)
Следующее
От: Melanie Plageman
Дата:
Сообщение: Re: lazy_scan_heap() should release lock on buffer before vacuuming FSM