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 1uMyOm-008eda-5x for pgsql-hackers@arkaria.postgresql.org; Thu, 05 Jun 2025 00:24:00 +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 1uMyOj-001I3M-5y for pgsql-hackers@arkaria.postgresql.org; Thu, 05 Jun 2025 00:23:57 +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 1uMyOi-001I3D-9Y for pgsql-hackers@lists.postgresql.org; Thu, 05 Jun 2025 00:23:57 +0000 Received: from fhigh-a5-smtp.messagingengine.com ([103.168.172.156]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1uMyOg-000GTY-29 for pgsql-hackers@lists.postgresql.org; Thu, 05 Jun 2025 00:23:56 +0000 Received: from phl-compute-05.internal (phl-compute-05.phl.internal [10.202.2.45]) by mailfhigh.phl.internal (Postfix) with ESMTP id 5707F1140229; Wed, 4 Jun 2025 20:23:52 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-05.internal (MEProxy); Wed, 04 Jun 2025 20:23:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm1; t=1749083032; x=1749169432; bh=C8N6fOPkyA jXWDwGfgW9Ax8BuYyUjhP/A1dxYII44LY=; b=weETKIAn60WRtMzLONgBlo5ZlX FTpFksephU/iWEiEnKH+1uNaEwLO8VNNsN47sFaTBGLIqDdpI95mhIh5uySUj0uA kt9oXO3DF8wr5k20f0U0Z3fu9lk/f+WljuoyZ2otOG1KYdhLD0wW33OgwbQOTpla /x9QYg/QrKuEEGoBUVqqZ4iGg3iDX0fhtO+BwLcj7E1a6rxsbNwCzphS9hOZJWcT wbjqXYWgad9qPT2WKIn5y8MqKWoGzoRm3LI2h6fSpRUK80UtL60urgK4KToW+/MW I+daVq+XxOTpoWC/Z7Lc+th4BH3zEgHyRpfkq5G+H+yphx66PKGocetXSIuA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1749083032; x=1749169432; bh=C8N6fOPkyAjXWDwGfgW9Ax8BuYyUjhP/A1d xYII44LY=; b=KjxATNyvg70rH+WauSQucRFzLoPIHrXaa2vnvaTckN8vF0f6v4G MzV36pQJChZYnEEHYXI4aCjic+1Dx2XDUJoYx5mlB9t0/8+YUYyw8bFHCl69m9q8 PY9KdAy0MHF3Ch2GF8kwLFAaTc0JEnAr3AQnWNQrodZvfdOAlqM7xQZCdP65G/3T 65EovnViqw2dnTo6qCn3TAEPfgoHIPmpqR91BowNaC/xA3oIMA1og2WHldyy1yh2 jqDyZ+IFPLWyAawdV5AdRWDLUY7R9oQgsNCT7dtMySJ0VF2t2vR3P+tu+npdmmtL 6M3xTHbxh72y4Zb2SR75k2v+Z+SSQLzWESw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtddugddvkeejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnegfrhhlucfvnfffucdljedtmdenucfjughrpeffhffvvefukfhf gggtuggjsehgtderredttddvnecuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruc eomhhitghhrggvlhesphgrqhhuihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepteel ieefudffhffhtdetleeggeegfffhkeeuveetiefgudduvedutefggeeivdejnecuvehluh hsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlhes phgrqhhuihgvrhdrgiihiidpnhgspghrtghpthhtohepgedpmhhouggvpehsmhhtphhouh htpdhrtghpthhtohepnhgrthhhrghnuggsohhsshgrrhhtsehgmhgrihhlrdgtohhmpdhr tghpthhtohepshhhihhnhigruddurdhkrghtohesghhmrghilhdrtghomhdprhgtphhtth hopegurghvihgurdhgrdhjohhhnhhsthhonhesghhmrghilhdrtghomhdprhgtphhtthho pehpghhsqhhlqdhhrggtkhgvrhhssehlihhsthhsrdhpohhsthhgrhgvshhqlhdrohhrgh X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 4 Jun 2025 20:23:50 -0400 (EDT) Date: Thu, 5 Jun 2025 09:23:42 +0900 From: Michael Paquier To: Nathan Bossart Cc: Shinya Kato , "David G. Johnston" , Postgres hackers Subject: Re: Partitioned tables and [un]loggedness Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="k8hvF5/+5wglAkUO" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --k8hvF5/+5wglAkUO Content-Type: multipart/mixed; boundary="Gv+kTAVYsyYEBdOh" Content-Disposition: inline --Gv+kTAVYsyYEBdOh Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Jun 04, 2025 at 11:15:29AM -0500, Nathan Bossart wrote: > I see no benefit in recommending things that are guaranteed to error. In > commit 5c1ce1b, we removed tab completion for CREATE UNLOGGED MATERIALIZED > VIEW even though it is supported by the grammar. The partitioned table > case sounds like roughly the same situation. Agreed to not suggest the PARTITION BY clause in the tab completion as it is not supported by the backend for unlogged tables. tab-complete.in.c has some handling for CREATE UNLOGGED TABLE around line 3667, so we could just have an extra case for it, like in the attached patch. A split already exists for temporary tables to handle the ON COMMIT clause after the attribute list. Thoughts? -- Michael --Gv+kTAVYsyYEBdOh Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="psql-tab-unlogged.patch" diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c index ec65ab79fecb..620830feb9d7 100644 --- a/src/bin/psql/tab-complete.in.c +++ b/src/bin/psql/tab-complete.in.c @@ -3664,9 +3664,10 @@ match_previous_words(int pattern_id, TailMatches("CREATE", "TEMP|TEMPORARY|UNLOGGED", "TABLE", MatchAny, "(*)", "AS")) COMPLETE_WITH("EXECUTE", "SELECT", "TABLE", "VALUES", "WITH"); /* Complete CREATE TABLE name (...) with supported options */ - else if (TailMatches("CREATE", "TABLE", MatchAny, "(*)") || - TailMatches("CREATE", "UNLOGGED", "TABLE", MatchAny, "(*)")) + else if (TailMatches("CREATE", "TABLE", MatchAny, "(*)")) COMPLETE_WITH("AS", "INHERITS (", "PARTITION BY", "USING", "TABLESPACE", "WITH ("); + else if (TailMatches("CREATE", "UNLOGGED", "TABLE", MatchAny, "(*)")) + COMPLETE_WITH("AS", "INHERITS (", "USING", "TABLESPACE", "WITH ("); else if (TailMatches("CREATE", "TEMP|TEMPORARY", "TABLE", MatchAny, "(*)")) COMPLETE_WITH("AS", "INHERITS (", "ON COMMIT", "PARTITION BY", "USING", "TABLESPACE", "WITH ("); --Gv+kTAVYsyYEBdOh-- --k8hvF5/+5wglAkUO Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmhA444ACgkQnvQgOdby QH1KHg//ffeFml2MBmpMxl1nEZR8BSnTIsvhwn2Sz4IM+sVO+Zn3Pp5/c57+4iah hrXhbpoldoFKs04RIt2Dkqpm5HmKNa4A/mhdpdQ1fp8GHe8L/72AJlDJ4vOQQLdB iVTzMF/+Amg0ch9bHEcsuNrnVufcfxKwwgN3HrmpdvyiWPsliOJhLUhWz8+eoUPp gr/o6SfiecX+OSEAl5NiiaQiAt0BT0aCEIT0+QZgRRORixeId8C+F7U6MF3B7SGs fBKYJMuXAr2/BsW4rX+LKr3wgv7fo5ovqkjSKnzI6gbYbNTozF+6SU3TblFw/dIa iGB520O2DnfCi0+5pPddo6BXBSl0KueKDdZJo5tGx62e8t99Jk1ujyyRF9rdlis2 Sjt7Px1FPp3ni4M8yejUpVEE1iWQ6qM8x72TIyR60o6HGyuYEvQHV8DH/d01ITr9 BzgrgAhEnIX0dvbbniABHMORLxzjs07H9xugVTUo+ji92WQFMxF3p9BqbQWK2386 a9iHM1BHhFKmQwBdviQpvvoAIGvJQsl5jPotCVb/NQknEaYvA0nW8J7T++bForXU jVxtA/y3v6V0YJxCkP080B2Yamc0/mUv9Fa9L8j3/8DBL1/14TvQ3/4Px2JJDn9G f2QRHQuntFP7wJD5EHew3YfinJhLp/rYa1YZOjYxUZIlLoYduh0= =d8Kr -----END PGP SIGNATURE----- --k8hvF5/+5wglAkUO--