Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sj3KI-00DXbQ-Qa for pgsql-hackers@arkaria.postgresql.org; Tue, 27 Aug 2024 21:02:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sj3KF-00CjME-Qe for pgsql-hackers@arkaria.postgresql.org; Tue, 27 Aug 2024 21:02:04 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sj3KF-00CjM6-Fd for pgsql-hackers@lists.postgresql.org; Tue, 27 Aug 2024 21:02:04 +0000 Received: from mail-io1-xd34.google.com ([2607:f8b0:4864:20::d34]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sj3KD-001k2O-K5 for pgsql-hackers@lists.postgresql.org; Tue, 27 Aug 2024 21:02:02 +0000 Received: by mail-io1-xd34.google.com with SMTP id ca18e2360f4ac-8252abac5bcso239531239f.0 for ; Tue, 27 Aug 2024 14:02:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724792521; x=1725397321; darn=lists.postgresql.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=EIGGUMP+9pHBDR4MRmeQj2iFg0C0K7Sr2OxL1yNLXKk=; b=cBhAyw8cYSbRiGET99ornRFwrqTTWUf8CoMXe/oxncb4ynmf7SDk/CurL6cOWWB46E +3a3oMED04kPnNukh55tySsl6zLWBREtwY9/AthggKynB+4Rygh6Jpi+9ADiSUeaI0P7 E82Exj/s4t+ETofzfb5Ih6mQcXfYCGyaLglib6+JdlO1uURXJOgHn5mvHCi5S1bexFgW P2ntFtg8pHiE9M6UwTdYEpseCr6r0fLJavani8lgxxpNyFYD8U4kxTKEgxtQxHAIS+aK ZrTA2xiZf0NIrtx+OQK3YU/pDuZx7nxKNDgDaNMfGGfz1DAwOxkQkgkveFM56yK6VMS6 gkMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724792521; x=1725397321; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=EIGGUMP+9pHBDR4MRmeQj2iFg0C0K7Sr2OxL1yNLXKk=; b=Tt+JQ1N6eEY8LJkKh8CaK5jkg4E7icwvCfKbEUCDYA86VxZt7JUCL18Cuy81BptHHS hwxwWsly0fV8kFddH1dqlladMHKN5uLAhMV1AcpjRdfoGRhv6ESqTFR2czXg+tmFAWJE nRF+/19GQd5x2/KtazYEFadmaufOvh9emUsqmrlVVSwyiezYHZ1In3eby0JFENxNjQTK W2MG8DpDOxEUniPEsTgUcuLU7fa1vcUrPfuToPBWLFe92lkpgyN44M5yFEG4fxo5jFLP rvxEjeOcZfUddtVn1MfUKOkEViF/XPy983Nd6eUpYBq5e5Z76TSo+8D8V99fKKtr4C5h muaQ== X-Forwarded-Encrypted: i=1; AJvYcCWrFR1QAkWJrkE7isSI4JLdaqzpZACNNmKqT6uOmdTwWWxZNs99rwf8X6Vl0UXHb5y9bPYRJCr9cdQf5IAz@lists.postgresql.org X-Gm-Message-State: AOJu0YwNI4Kqu+S7gBLIv3KnZ0jPAmltgc00RG5OflILK63tQ/D8jVyY fgdfqF94gDK7vsjrlel6BdKqfhUO1wzTL2XtYATS9An1dD9aVSdR X-Google-Smtp-Source: AGHT+IEQqb1B43BRz5QdFbpVY8EzuDe2iCVFufrsXGeK6jPT+OgBvvF8pq+a//iIBzgE1mt+7ba72A== X-Received: by 2002:a05:6e02:12c2:b0:39b:3894:9298 with SMTP id e9e14a558f8ab-39f3247cf45mr391835ab.0.1724792520538; Tue, 27 Aug 2024 14:02:00 -0700 (PDT) Received: from nathan (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4ce7106ad15sm2745063173.116.2024.08.27.14.01.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Aug 2024 14:02:00 -0700 (PDT) Date: Tue, 27 Aug 2024 16:01:58 -0500 From: Nathan Bossart To: Michael Paquier Cc: "David G. Johnston" , Postgres hackers Subject: Re: Partitioned tables and [un]loggedness Message-ID: References: <20240424202640.GB861150@nathanxps13> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, May 02, 2024 at 03:06:51PM +0900, Michael Paquier wrote: > The case of a temporary persistence is actually *very* tricky. The > namespace, where the relation is created, is guessed and locked with > permission checks done based on the RangeVar when the CreateStmt is > transformed, which is before we try to look at its inheritance tree to > find its partitioned parent. So we would somewhat need to shortcut > the existing RangeVar lookup and include the parents in the loop to > find out the correct namespace. And this is much earlier than now. > The code complexity is not trivial, so I am getting cold feet when > trying to support this case in a robust fashion. For now, I have > discarded this case and focused on the main problem with SET LOGGED > and UNLOGGED. > > Switching between logged <-> unlogged does not have such > complications, because the namespace where the relation is created is > going to be the same. So we won't lock or perform permission checks > on an incorrect namespace. I've been thinking about this thread some more, and I'm finding myself -0.5 for adding relpersistence inheritance for UNLOGGED. There are a few reasons: * Existing partitioned tables may be marked UNLOGGED, and after upgrade, new partitions would be UNLOGGED unless the user discovers that they need to begin specifying LOGGED or change the persistence of the partitioned table. I've seen many problems with UNLOGGED over the years, so I am wary about anything that might increase the probability of someone using it accidentally. * I don't think partitions inheriting persistence is necessarily intuitive. IIUC there's nothing stopping you from having a mix of LOGGED and UNLOGGED partitions, so it's not clear to me why we should assume that users want them to be the same by default. IMHO UNLOGGED is dangerous enough that we really want users to unambiguously indicate that's what they want. * Inheriting certain persistences (e.g., UNLOGGED) and not others (e.g., TEMPORARY) seems confusing. Furthermore, if a partitioned table is marked TEMPORARY, its partitions must also be marked TEMPORARY. There is no such restriction when a partitioned table is marked UNLOGGED. 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. -- nathan