Re: BUG #18151: pg_upgradecluster fails when column default refers to column

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: BUG #18151: pg_upgradecluster fails when column default refers to column
Дата
Msg-id CAKFQuwa8=RVgMFLVuyC7izD5-OaBMRhN_kjg7+fiD3GY3ivo1A@mail.gmail.com
обсуждение исходный текст
Ответ на BUG #18151: pg_upgradecluster fails when column default refers to column  (PG Bug reporting form <noreply@postgresql.org>)
Ответы Re: BUG #18151: pg_upgradecluster fails when column default refers to column  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
On Sunday, October 8, 2023, PG Bug reporting form <noreply@postgresql.org> wrote:
The following bug has been logged on the website:

Bug reference:      18151
Logged by:          Liam Morland
Email address:      liam@morland.ca
PostgreSQL version: 15.4
Operating system:   Debian
Description:       

I was trying to upgrade to PG 16:
pg_upgradecluster 15 main

I got this error:
pg_restore: error: could not execute query: ERROR:  relation "event" does
not exist

The reason is the the default value for column "event_id" of table "event"
is "event_id_nextval()". That function is:
SELECT COALESCE(MAX(event_id) + 1, 1) FROM event;

You are expressly forbidden to have the default value expression of a column reference a subquery. You must use a trigger.  The failure to prevent the exoressions creation or consistently report such a failure is the bug, not this.  Unfortunately preventing the behavior is not reasonable, we can only document its forbiddance.

David J.

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: BUG #18151: pg_upgradecluster fails when column default refers to column
Следующее
От: Tom Lane
Дата:
Сообщение: Re: BUG #18151: pg_upgradecluster fails when column default refers to column