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 1sWz9m-000q1c-QL for pgsql-hackers@arkaria.postgresql.org; Thu, 25 Jul 2024 14:09:22 +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 1sWz9l-00Fg8M-9V for pgsql-hackers@arkaria.postgresql.org; Thu, 25 Jul 2024 14:09:21 +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 1sWz9k-00Fg8E-NF for pgsql-hackers@lists.postgresql.org; Thu, 25 Jul 2024 14:09:20 +0000 Received: from fhigh3-smtp.messagingengine.com ([103.168.172.154]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sWz9g-001Nve-Nj for pgsql-hackers@postgresql.org; Thu, 25 Jul 2024 14:09:19 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailfhigh.nyi.internal (Postfix) with ESMTP id 0A0191140150; Thu, 25 Jul 2024 10:09:12 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Thu, 25 Jul 2024 10:09:12 -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=1721916552; x=1722002952; bh=qP0C+yGs3I akqAwOszAhio2kpKjRRhTYTqN95qdiNHk=; b=MjiBjOdzbSA6gZzgpYO7buU91Q fpQF7nfkyrPcfPft4GfcNNj8Y2gbYMM1IcM61dmKziJaYBqCX/+iXxDkB2KYP6Kd VKDMFGP2gFPTre26ISXkvYD7wWktn/5JQ4nM9PoqKFcasNjetEED3YRxnJo4+4zM 1OVU2blZcKf5CRNt+XndKIkbagcHeQ8Rl9l/ehN6r425eQ92SjRQgz7Y3xZu44+B /QC5elvMzKg6X640YYC4SseFO0UnD6JEgKje+xG/DaisC2aYY7rK2Z5H44VbUQ/5 InYfjfFO5Ov5sMXD5ZxNSiA8Re0DFdrwFOAlT+grLneueQzlE6Q9/K4x0YPw== 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=1721916552; x=1722002952; bh=qP0C+yGs3IakqAwOszAhio2kpKjR RhTYTqN95qdiNHk=; b=SkBLMxEICDN+fo76ulrxuBjJgFNSkKl3LjAkkQtkJy0h 89pYmWWYU/sjSD3UC9jxptvL2bXo/9P9EiNNuRlQ8QngwztQ9po5U6kQsX4/cx35 Ve0IRRNU/iW1aEO/zrmZW3ylOqEVAhmdalSIPQvIRafRu2VoStV/faPF44Ohqqzp kcLvW+SC/5AS3LSQHgfLKPAsLWQeUuwGZ3AWvYTaPNG7sYDdnPVWgYJfH/VXYTJO 87YIZhnIrq+sMbfW43WZDoN5s80Z5AZrZoaHh71L5fzuj3gHuBQJ+rvZHOjTBnEL CxreulGL3eT42k3O9llHur7vNBRFKWrV63e5xYjiAw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrieefgdejfecutefuodetggdotefrodftvf 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 10:09:11 -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: <87cyn1eft4.fsf@wibble.ilmari.org> Date: Thu, 25 Jul 2024 15:09:09 +0100 In-Reply-To: <87cyn1eft4.fsf@wibble.ilmari.org> ("Dagfinn Ilmari =?utf-8?Q?Manns=C3=A5ker=22's?= message of "Thu, 25 Jul 2024 14:56:07 +0100") Message-ID: <87a5i5ef7e.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; charset=utf-8 Content-Transfer-Encoding: 8bit Dagfinn Ilmari Mannsåker writes: > 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. Scratch that, I misread the diff. The tab completion has been there since matviews were added in commit 3bf3ab8c5636, but the restriction on unlogged matviews was added later in commit 3223b25ff73, which failed to update the tab completion code to match. Here's a updated patch with a corrected commit message. - ilmari --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=v2-0001-Don-t-tab-complete-MATERIALIZED-VIEW-after-CREATE.patch From 58aebeda0c2161598b58f468d3c46b113651fb79 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 v2] Don't tab complete MATERIALIZED VIEW after CREATE UNLOGGED When materialized views were originally added in commit 3bf3ab8c5636, they could be unlogged, so the tab completion was added. However, when commit 3223b25ff73 banned them, the tab completion was not updated to match. --- 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 --=-=-=--