Internal error while setting reloption on system catalogs.

Started by Kyotaro Horiguchiabout 7 years ago4 messageshackers
Jump to latest
#1Kyotaro Horiguchi
horikyota.ntt@gmail.com

Hello.

The following command complains with an internal
error. (allow_system_table_mods is on).

alter table pg_attribute set (fillfactor = 90);

ERROR: AccessExclusiveLock required to add toast table.

The same happens for pg_class. This is because ATRewriteCatalogs
tries to add a toast table to the relations with taking
ShareUpdateExclusiveLock. The decision whether to provide a toast
table for each system catalog is taken in the commit 96cdeae07f
that the two relations won't have a toast relation, so we should
avoid that for all mapped relations.

I didn't find a place where ATTACH PARTITION sends
RELKIND_PARTITIONED_TABLE to the function so the case is omitted
in the patch. Actually the regression test doesn't complain with
the following assertion there in the function.

Assert(tab->relkind != RELKIND_PARTITIONED_TABLE ||
tab->partition_constraint == NULL ||
!tab->check_toast)

Many other commands seem not to need the toast check but the
patch doesn't care about them. It would be another issue.

According to alter_table.sql, it doesn't need a test.

-- XXX: It would be useful to add checks around trying to manipulate
-- catalog tables, but that might have ugly consequences when run
-- against an existing server with allow_system_table_mods = on.

The first attached is for master and 11.
The second is for 10.
The third is for 9.6.

9.4 and 9.5 doesn't suffer the problem but it is because they
create toast table for mapped relations at that time.

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center

Attachments:

allow_alter_table_on_system_catalog_master.patchtext/x-patch; charset=us-asciiDownload+19-9
allow_alter_table_on_system_catalog_pg10.patchtext/x-patch; charset=us-asciiDownload+18-9
allow_alter_table_on_system_catalog_pg96.patchtext/x-patch; charset=us-asciiDownload+10-2
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Kyotaro Horiguchi (#1)
Re: Internal error while setting reloption on system catalogs.

Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp> writes:

The following command complains with an internal
error. (allow_system_table_mods is on).

alter table pg_attribute set (fillfactor = 90);

ERROR: AccessExclusiveLock required to add toast table.

The same happens for pg_class.

Isn't this more or less the same thing Peter E. was attempting to fix in
https://commitfest.postgresql.org/22/1764/
?

The first attached is for master and 11.
The second is for 10.
The third is for 9.6.

It's not clear to me that we ought to consider catalog alterations
supported at all, but in any case I wouldn't treat it as something
to back-patch.

regards, tom lane

#3Kyotaro Horiguchi
horikyota.ntt@gmail.com
In reply to: Tom Lane (#2)
Re: Internal error while setting reloption on system catalogs.

At Tue, 05 Feb 2019 10:01:48 -0500, Tom Lane <tgl@sss.pgh.pa.us> wrote in <20605.1549378908@sss.pgh.pa.us>

Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp> writes:

The following command complains with an internal
error. (allow_system_table_mods is on).

alter table pg_attribute set (fillfactor = 90);

ERROR: AccessExclusiveLock required to add toast table.

The same happens for pg_class.

Isn't this more or less the same thing Peter E. was attempting to fix in
https://commitfest.postgresql.org/22/1764/
?

Uggh Right. One of the problem is the same with this. Thank you
for the pointer, Tom.

The first attached is for master and 11.
The second is for 10.
The third is for 9.6.

It's not clear to me that we ought to consider catalog alterations
supported at all, but in any case I wouldn't treat it as something
to back-patch.

I'm ok with that. Considering using reloption on system catalogs
let me notice it.

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center

#4Michael Paquier
michael@paquier.xyz
In reply to: Kyotaro Horiguchi (#3)
Re: Internal error while setting reloption on system catalogs.

On Wed, Feb 06, 2019 at 09:09:32AM +0900, Kyotaro HORIGUCHI wrote:

At Tue, 05 Feb 2019 10:01:48 -0500, Tom Lane <tgl@sss.pgh.pa.us> wrote in <20605.1549378908@sss.pgh.pa.us>

Isn't this more or less the same thing Peter E. was attempting to fix in
https://commitfest.postgresql.org/22/1764/?

Uggh Right. One of the problem is the same with this. Thank you
for the pointer, Tom.

It would be really nice if you could review that. The patch has been
around for some time and I think that we could get that into 12.
--
Michael