Re: Partitioned tables and [un]loggedness

Nathan Bossart <nathandbossart@gmail.com>

From: Nathan Bossart <nathandbossart@gmail.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: "David G. Johnston" <david.g.johnston@gmail.com>, Postgres hackers <pgsql-hackers@lists.postgresql.org>
Date: 2024-08-29T14:49:44Z
Lists: pgsql-hackers
On Thu, Aug 29, 2024 at 03:44:45PM +0900, Michael Paquier wrote:
> On Tue, Aug 27, 2024 at 04:01:58PM -0500, Nathan Bossart wrote:
>> My current thinking is that it would be better to disallow marking
>> partitioned tables as LOGGED/UNLOGGED and continue to have users explicitly
>> specify what they want for each partition.  It'd still probably be good to
>> expand the documentation, but a clear ERROR when trying to set a
>> partitioned table as UNLOGGED would hopefully clue folks in.
> 
> The addition of the new LOGGED keyword is not required if we limit
> ourselves to an error when defining UNLOGGED, so if we drop this
> proposal, let's also drop this part entirely and keep DefineRelation()
> simpler.

+1

> Actually, is really issuing an error the best thing we can
> do after so many years allowing this grammar flavor to go through,
> even if it is perhaps accidental?  relpersistence is marked correctly
> for partitioned tables, it's just useless.  Expanding the
> documentation sounds fine to me, one way or the other, to tell what
> happens with partitioned tables.

IMHO continuing to allow partitioned tables to be marked UNLOGGED just
preserves the illusion that it does something.  An ERROR could help dispel
that misconception.

-- 
nathan



Commits

  1. psql: Remove PARTITION BY clause in tab completion for unlogged tables

  2. Remove support for unlogged on partitioned tables

  3. Remove ATT_TABLE for ALTER TABLE ... ATTACH/DETACH

  4. Introduce ATT_PARTITIONED_TABLE in tablecmds.c

  5. Refactor some code for ALTER TABLE SET LOGGED/UNLOGGED in tablecmds.c

  6. Remove tab completion for CREATE UNLOGGED MATERIALIZED VIEW.