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 1sZaan-0022Fh-UX for pgsql-hackers@arkaria.postgresql.org; Thu, 01 Aug 2024 18:32:01 +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 1sZaam-00CbWE-EO for pgsql-hackers@arkaria.postgresql.org; Thu, 01 Aug 2024 18:32:00 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sZaam-00CbW6-4W for pgsql-hackers@lists.postgresql.org; Thu, 01 Aug 2024 18:32:00 +0000 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sZaaj-002eKd-Im for pgsql-hackers@postgresql.org; Thu, 01 Aug 2024 18:31:59 +0000 Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-1fc66fc35f2so17881745ad.0 for ; Thu, 01 Aug 2024 11:31:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=j-davis-com.20230601.gappssmtp.com; s=20230601; t=1722537115; x=1723141915; darn=postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=SeqIZ19ZBLLnMiG5maSVapVSc6sCCi1Km7cxzvSR4aM=; b=tonPvsPpnhtDnzprUkpW+MYcIwJUq3OdIJIik2AV3MDSnCQJ4EC/EKndBD/2aevSDH GUFgFevYSfJa/vzQkf//38sZIWrKLuuM80ypUUOl0NH3YVgaXM9LM8Z38IYCHZ+IdbtJ eXH+1QPQPp9ffBRsby/7CrZfJmCKCwBGHNjCRiRWAXs0kB5RXxTdUS0WvO2VCl3Bnpdf WfhKm8A65YZpM5wwztwkzAO9gCIX/F+r9uP9D0dUcFIu09gM6soEvtKmFPbN/UX1mXCV 6MQyFQcSUxTRHvgCfcRlf9GDuFwwplpmMVYise6afe20yAvbgNCI+8ZB9FM1LdOP1vNe zXGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722537115; x=1723141915; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=SeqIZ19ZBLLnMiG5maSVapVSc6sCCi1Km7cxzvSR4aM=; b=ssdCdBB7guC2fLUKCnAZ7ONX+e9QaOe90SNjuUK4CST96d8yp7KQdtvm5O+z90rMYQ pAIpwBf8P/wYP55kkWUtkkzbODhSGLKYmIyqKe7nXQcrEsYn4EYZerQYoH7BEGdx/+Ux Ws0Vf4oS/uZ+peEhOwJRzYJdgOiColXiJBu0WFNrZguI3Cn0IS4l/wJakEwZ3RZ5kg9g YvfXJb6eqxgj4o1pY3XjbtgNqFhMbNrd5DZrPYxERa4XDxLijSTGAlUk8IGwYeUgkl5/ dCWDVMxDYZ9wU9c5JDWQ4pbIK0ll3OmwquhTw9Wkcpr3YX6hfWo55AboHziHTue1PkxX 25cA== X-Forwarded-Encrypted: i=1; AJvYcCXaYa0im4XI5+RHPaSl/YEBwLdBNqb175htYziMzbKw6vZlXRp5tCiPRw9lbS5mmY85a9BafaYnQaxbA0k/MKZQB6mcjabki3JgawBe X-Gm-Message-State: AOJu0Yy9NwOM2chRu+ji0vTxWSpbOQj8lGnln4y5EqrIwcnsD5BKiIZk t5/8sWbVc+UD0ghhX/ox0iEAh9n681/jjUyTbH2r5BmLbLEX/D+BXEqs7eIKAA== X-Google-Smtp-Source: AGHT+IEwI5pMh68Q9+GplVDxLcP/RSdTryg0aLF2ifBZCacG0u1DrBmRm2XxVcNBZKUhR/vinnZmKA== X-Received: by 2002:a17:902:f68d:b0:1fd:9154:2d05 with SMTP id d9443c01a7336-1ff5243c286mr37107205ad.14.1722537114997; Thu, 01 Aug 2024 11:31:54 -0700 (PDT) Received: from jeff-laptop.lan (c-76-102-242-158.hsd1.ca.comcast.net. [76.102.242.158]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1ff592b6915sm1883045ad.305.2024.08.01.11.31.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Aug 2024 11:31:54 -0700 (PDT) Message-ID: <6bf8a76ebf3215d2226dbc2245d351aae577e4c1.camel@j-davis.com> Subject: Re: MAINTAIN privilege -- what do we need to un-revert it? From: Jeff Davis To: Yugo NAGATA Cc: Noah Misch , Michael Paquier , Nathan Bossart , pgsql-hackers@postgresql.org, Joe Conway , Robert Haas Date: Thu, 01 Aug 2024 11:31:53 -0700 In-Reply-To: <20240731182012.45d8231608896732395fc81a@sraoss.co.jp> References: <20240228165523.GA2435539@nathanxps13> <31ae1bf73e8a1dae3ee7ef2dd43a9bbda1e1ab86.camel@j-davis.com> <20240630222344.db.nmisch@google.com> <23fac3b2a722373a52b92a12ee0f500821450f97.camel@j-davis.com> <20240711125207.98.nmisch@google.com> <20240712231149.0d.nmisch@google.com> <8e0438821bddd4de198989e6ac0f9a2aa27cabeb.camel@j-davis.com> <20240713214748.cb@rfd.leadboat.com.sranhm> <20240726122630.70e889f63a4d7e26f8549de8@sraoss.co.jp> <20240731182012.45d8231608896732395fc81a@sraoss.co.jp> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.4-0ubuntu2 MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, 2024-07-31 at 18:20 +0900, Yugo NAGATA wrote: > I agree that it might not be important, but I think adding the flag > would be > also helpful for improving code-readability because it clarify the > function > is used in the two cases. I attached patch for this fix (patch 0003). Committed with one minor modification: I moved the boolean flag to be near the other booleans rather than at the end. Thank you. > Sure. I fixed the patch to remove 'param' from both functions. (patch > 0002) Committed, thank you. > I also add the small refactoring around ExecCreateTableAs(). (patch > 0001) >=20 > - Remove matview-related codes from intorel_startup. > =C2=A0 Materialized views are no longer handled in this function. >=20 > - RefreshMatViewByOid is moved to just after create_ctas_nodata > =C2=A0 call to improve code readability. >=20 I'm not sure the changes in intorel_startup() are correct. I tried adding an Assert(into->viewQuery =3D=3D NULL), and it fails because there's another path I did not consider: "EXPLAIN ANALYZE CREATE MATERIALIZED VIEW ...", which does not go through ExecCreateTableAs() but does go through CreateIntoRelDestReceiver(). See: https://postgr.es/m/20444c382e6cb5e21e93c94d679d0198b0dba4dd.camel@j-davis.= com Should we refactor a bit and try to make EXPLAIN use the same code paths? Regards, Jeff Davis