pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
To: Andres Freund <andres@anarazel.de>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Michael Paquier <michael@paquier.xyz>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: ALTER TABLE on system catalogs
Date: Fri, 28 Sep 2018 22:58:36 +0200
Message-ID: <61666008-d1cd-7a66-33c8-215449f5d1b0@2ndquadrant.com> (raw)
In-Reply-To: <20180821152444.4reji5otfekmvtoc@alap3.anarazel.de>
References: <20180627203733.bfpibxdleimvwdg2@alap3.anarazel.de>
	<20180627230838.GI2667@paquier.xyz>
	<9fb22a98-fd64-1426-a4f4-b927ce1a9a5e@2ndquadrant.com>
	<920b7cde-6926-4ad3-936b-7637f0a8188f@2ndquadrant.com>
	<20180820023749.GD7403@paquier.xyz>
	<20180820104825.a7yryvlycwimgttf@alap3.anarazel.de>
	<b49018c4-6592-eece-f5db-5978fda1f5df@2ndquadrant.com>
	<20180820125022.kh37mj7sxtaxeize@alap3.anarazel.de>
	<19365.1534772090@sss.pgh.pa.us>
	<a33f9d7f-4afe-a351-3528-cc32b0603845@2ndquadrant.com>
	<20180821152444.4reji5otfekmvtoc@alap3.anarazel.de>

On 21/08/2018 17:24, Andres Freund wrote:
>> Attached is a patch that instead moves those special cases into
>> needs_toast_table(), which was one of the options suggested by Andres.
>> There were already similar checks there, so I guess this makes a bit of
>> sense.
> The big difference is that that then only takes effect when called with
> check=true. The callers without it, importantly NewHeapCreateToastTable
> & NewRelationCreateToastTable, then won't run into this check. But still
> into the error (see below).

I don't follow.  The call to needs_toast_table() is not conditional on
the check argument.  The check argument only checks that the correct
lock level is passed in.

>> @@ -145,21 +146,6 @@ create_toast_table(Relation rel, Oid toastOid, Oid toastIndexOid,
>>  	ObjectAddress baseobject,
>>  				toastobject;
>>  
>> -	/*
>> -	 * Toast table is shared if and only if its parent is.
>> -	 *
>> -	 * We cannot allow toasting a shared relation after initdb (because
>> -	 * there's no way to mark it toasted in other databases' pg_class).
>> -	 */
>> -	shared_relation = rel->rd_rel->relisshared;
>> -	if (shared_relation && !IsBootstrapProcessingMode())
>> -		ereport(ERROR,
>> -				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
>> -				 errmsg("shared tables cannot be toasted after initdb")));
> This error check imo shouldn't be removed, but moved down.

We could keep it, but it would probably be dead code since
needs_toast_table() would return false for all shared tables anyway.

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services




view thread (25+ messages)  latest in thread

Message-ID: <61666008-d1cd-7a66-33c8-215449f5d1b0@2ndquadrant.com>
Permalink:  ../61666008-d1cd-7a66-33c8-215449f5d1b0@2ndquadrant.com/
Also on:    postgresql.org/message-id/61666008-d1cd-7a66-33c8-215449f5d1b0@2ndquadrant.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: peter.eisentraut@2ndquadrant.com, andres@anarazel.de, tgl@sss.pgh.pa.us, michael@paquier.xyz
  Subject: Re: ALTER TABLE on system catalogs
  In-Reply-To: <61666008-d1cd-7a66-33c8-215449f5d1b0@2ndquadrant.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox