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 1sWyx8-000p9w-6y for pgsql-hackers@arkaria.postgresql.org; Thu, 25 Jul 2024 13:56:18 +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 1sWyx6-00FUL1-Ib for pgsql-hackers@arkaria.postgresql.org; Thu, 25 Jul 2024 13:56:16 +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 1sWyx5-00FUKt-QG for pgsql-hackers@lists.postgresql.org; Thu, 25 Jul 2024 13:56:16 +0000 Received: from fhigh3-smtp.messagingengine.com ([103.168.172.154]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sWyx2-001P9t-JW for pgsql-hackers@postgresql.org; Thu, 25 Jul 2024 13:56:15 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailfhigh.nyi.internal (Postfix) with ESMTP id 7EE86114019B; Thu, 25 Jul 2024 09:56:10 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Thu, 25 Jul 2024 09:56:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ilmari.org; 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=fm2; t=1721915770; x=1722002170; bh=PKq91UmXeW vPB+QeTEeEg2xr/LC7pEPBYtx/eeWdV3s=; b=jORnJcq+ScOp+xexyz4McI0mVt JTV9Q5j4Bj52LPSW9ymslJAi+CVw99IeSalA7hpQshrF3XBxZZLs1dDKsX2V9qT/ Se8/tcLLXsf5K9jqHdeT8RzpTHjU+9EDzLSNz7An661w8ud8bow9newGwxOkr3Vr FugTQXvZ2Dcugr8tEn9+0xukivbAAf+88tj8HQo7UPaH5d3XTsHONR5WxU+RDSUJ q0gsETMJjXvNemfNAuxAqkq+YuWFVA9dV0WfTb4KhzpvrWmt8kX2ZYLyed5IrXkQ CXmwZ295mrc7QUosBDzjBi1q9wcTclbp4xcGR6aLXYckMpK8+DEIWH/N0zoA== 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-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1721915770; x=1722002170; bh=PKq91UmXeWvPB+QeTEeEg2xr/LC7 pEPBYtx/eeWdV3s=; b=oxPPpqSE1xQmctXHYmcXZyf4HuXJjpk9vguKQe02mzE4 HB2APQbiuhJx3f3lyN7JtItUZAV+lAoILuEjan/ebI44dgtnIZaA6HH/rADj/rTH 3s0qIQMVffJbNyt9zp7uW8PyYzNB2mtF2KTUW6g2I7PcurOFlz/KfO4/L0OoWcMw pDLpaOktRFwOLR6YqrPAQ+0SxYWHfRvj67bYqgrrKqGoWADPAIh8LlBR9fq0F+a6 ZM2WCoNMGyjRJlQEVacCiuT8wxnplphbwkHo+fWehRkMTmnka63gPOLnbdEV4Ypt sgfbXs9oD4QVf2zpr4gzs70TN7UdaPN/pf3KSJ5cLQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrieefgdejtdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvvefufhffjgfkfgggtgesmhdtre ertderjeenucfhrhhomhepffgrghhfihhnnhcukfhlmhgrrhhiucforghnnhhsnohkvghr uceoihhlmhgrrhhisehilhhmrghrihdrohhrgheqnecuggftrfgrthhtvghrnhepvddvhf ehtdefkedugfetudefhefggfegjeeijeehuefgteehgfegtdelgeetteejnecuvehluhhs thgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepihhlmhgrrhhisehilh hmrghrihdrohhrghdpnhgspghrtghpthhtoheptd X-ME-Proxy: Feedback-ID: i1ff147bf:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 25 Jul 2024 09:56:09 -0400 (EDT) From: =?utf-8?Q?Dagfinn_Ilmari_Manns=C3=A5ker?= To: px shi Cc: pgsql-hackers@postgresql.org Subject: Re: CREATE MATERIALIZED VIEW References: Date: Thu, 25 Jul 2024 14:56:07 +0100 In-Reply-To: (px shi's message of "Thu, 25 Jul 2024 19:48:01 +0800") Message-ID: <87cyn1eft4.fsf@wibble.ilmari.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --=-=-= Content-Type: text/plain px shi writes: > Hi, I see that materialized view cannot be unlogged now, but when I use > psql and type CREATE UNLOGGED, pressing the Tab key for auto-completion > suggests `TABLE` and MATERIALIZED VIEW. > Shouldn't `MATERIALIZED VIEW ` be suggested? That's my fault, I added it in commit c951e9042dd1, presumably because the grammar allows it, but it turns transformCreateTableAsStmt() rejects it. Attached is a patch to fix it, which sholud be backpatched to v17. - ilmari --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Don-t-tab-complete-MATERIALIZED-VIEW-after-CREATE-UN.patch From f8bc4d760aadd5f1f3d805f6de7c0d6d3eb8d078 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dagfinn=20Ilmari=20Manns=C3=A5ker?= Date: Thu, 25 Jul 2024 14:33:14 +0100 Subject: [PATCH] Don't tab complete MATERIALIZED VIEW after CREATE UNLOGGED This was erroneously added in commit c951e9042dd1 because the grammar allows it, but it turns out transformCreateTableAsStmt() rejects it. --- src/bin/psql/tab-complete.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c index 891face1b6..024469474d 100644 --- a/src/bin/psql/tab-complete.c +++ b/src/bin/psql/tab-complete.c @@ -3267,15 +3267,9 @@ psql_completion(const char *text, int start, int end) /* Complete "CREATE TEMP/TEMPORARY" with the possible temp objects */ else if (TailMatches("CREATE", "TEMP|TEMPORARY")) COMPLETE_WITH("SEQUENCE", "TABLE", "VIEW"); - /* Complete "CREATE UNLOGGED" with TABLE, SEQUENCE or MATVIEW */ + /* Complete "CREATE UNLOGGED" with TABLE or SEQUENCE */ else if (TailMatches("CREATE", "UNLOGGED")) - { - /* but not MATVIEW in CREATE SCHEMA */ - if (HeadMatches("CREATE", "SCHEMA")) - COMPLETE_WITH("TABLE", "SEQUENCE"); - else - COMPLETE_WITH("TABLE", "SEQUENCE", "MATERIALIZED VIEW"); - } + COMPLETE_WITH("TABLE", "SEQUENCE"); /* Complete PARTITION BY with RANGE ( or LIST ( or ... */ else if (TailMatches("PARTITION", "BY")) COMPLETE_WITH("RANGE (", "LIST (", "HASH ("); -- 2.39.2 --=-=-=--