Re: Unable to create serial column even with permissions

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Unable to create serial column even with permissions
Дата
Msg-id 9832.1281921168@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Unable to create serial column even with permissions  (Josh Berkus <josh.berkus@pgexperts.com>)
Ответы Re: Unable to create serial column even with permissions  (Josh Berkus <josh@agliodbs.com>)
Re: Unable to create serial column even with permissions  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
Josh Berkus <josh.berkus@pgexperts.com> writes:
> [ as suitably privileged user, alter somebody else's table with ]
> alter table sometable add column someserial serial;
> ERROR:  sequence must have same owner as table it is linked to

> If the creating user has permissions on the table sufficient to create a
> column on the table, the sequence should be created as owned by the
> table owner.

Yeah, I think that would be the most desirable behavior.

It looks to me like the simplest way to make this happen would require
(a) adding a field to CreateSeqStmt to carry the userID we want the
sequence to be owned by;
(b) adding a parameter to DefineRelation to pass in said userID.

(Or we could add a field to CreateStmt rather than a separate parameter
to DefineRelation, but I'm unconvinced that's better.)

We could in theory back-patch this, since CreateSeqStmt won't ever go to
disk in stored rules.  However, tweaking DefineRelation's API in stable
branches seems fairly hazardous to third-party code.  Does it seem
sufficient to fix the problem in 9.0 and up?

            regards, tom lane

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: BUG #5608: array_agg() consumes too much memory
Следующее
От: Mariusz Majer
Дата:
Сообщение: Re: BUG #5614: Varchar column (with DEFAULT NULL) stores 'UL' value instead of null