Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nULOL-0000Zd-LK for pgsql-hackers@arkaria.postgresql.org; Wed, 16 Mar 2022 04:36:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nULOK-0006p6-AG for pgsql-hackers@arkaria.postgresql.org; Wed, 16 Mar 2022 04:36:08 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nULOK-0006ow-1I for pgsql-hackers@lists.postgresql.org; Wed, 16 Mar 2022 04:36:08 +0000 Received: from mx0a-0050f201.pphosted.com ([148.163.145.86]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nULO8-0005BW-HX for pgsql-hackers@postgresql.org; Wed, 16 Mar 2022 04:36:07 +0000 Received: from pps.filterd (m0203369.ppops.net [127.0.0.1]) by mx0b-0050f201.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 22G47HYH012399 for ; Wed, 16 Mar 2022 13:35:53 +0900 Received: from sraihe.sra.co.jp (sraihe.sra.co.jp [221.255.117.38]) by mx0b-0050f201.pphosted.com (PPS) with ESMTP id 3erc9we8gs-1 for ; Wed, 16 Mar 2022 13:35:53 +0900 Received: from srascb.sra.co.jp (srascb [133.137.8.65]) by sraihe.sra.co.jp (Postfix) with ESMTP id 850FD2A684A for ; Wed, 16 Mar 2022 13:35:52 +0900 (JST) Received: from sranhm.sra.co.jp (osspc47 [133.137.174.164]) by srascb.sra.co.jp (Postfix) with ESMTP id 765B258006D for ; Wed, 16 Mar 2022 13:35:52 +0900 (JST) Received: from yugon-CFSV7-1 (dhcp-175-183.sra.co.jp [133.137.175.183]) by sranhm.sra.co.jp (Postfix) with SMTP id 5A5493416A7 for ; Wed, 16 Mar 2022 13:35:52 +0900 (JST) Date: Wed, 16 Mar 2022 13:33:37 +0900 From: Yugo NAGATA To: pgsql-hackers@postgresql.org Subject: Tab completion for ALTER MATERIALIZED VIEW ... SET ACCESS METHOD Message-Id: <20220316133337.5dc9740abfa24c25ec9f67f5@sraoss.co.jp> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="Multipart=_Wed__16_Mar_2022_13_33_37_+0900_KaEvUkjzJegHt0vC" X-Proofpoint-ORIG-GUID: XbbufSadPWpy55BTIXiXXRwQdXMXc5PX X-Proofpoint-GUID: XbbufSadPWpy55BTIXiXXRwQdXMXc5PX X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10287 signatures=693139 X-Proofpoint-Spam-Details: rule=spam_low_notspam policy=spam_low score=0 mlxlogscore=999 priorityscore=1501 suspectscore=0 phishscore=0 spamscore=0 mlxscore=0 malwarescore=0 clxscore=1034 impostorscore=0 adultscore=0 bulkscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2203160026 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --Multipart=_Wed__16_Mar_2022_13_33_37_+0900_KaEvUkjzJegHt0vC Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Hello hackers, SET ACCESS METHOD is supported in ALTER TABLE since the commit b0483263dd. Since that time, this also has be allowed SET ACCESS METHOD in ALTER MATERIALIZED VIEW. Although it is not documented, this works. I cannot found any reasons to prohibit SET ACCESS METHOD in ALTER MATERIALIZED VIEW, so I think it is better to support this in psql tab-completion and be documented. I attached a patch to fix the tab-completion and the documentation about this syntax. Also, I added description about SET TABLESPACE syntax that would have been overlooked. Regards, Yugo Nagata -- Yugo NAGATA --Multipart=_Wed__16_Mar_2022_13_33_37_+0900_KaEvUkjzJegHt0vC Content-Type: text/x-diff; name="tab_complete_alter_matview.patch" Content-Disposition: attachment; filename="tab_complete_alter_matview.patch" Content-Transfer-Encoding: 7bit diff --git a/doc/src/sgml/ref/alter_materialized_view.sgml b/doc/src/sgml/ref/alter_materialized_view.sgml index 7011a0e7da..cae135c27a 100644 --- a/doc/src/sgml/ref/alter_materialized_view.sgml +++ b/doc/src/sgml/ref/alter_materialized_view.sgml @@ -43,6 +43,8 @@ ALTER MATERIALIZED VIEW ALL IN TABLESPACE namecolumn_name SET COMPRESSION compression_method CLUSTER ON index_name SET WITHOUT CLUSTER + SET ACCESS METHOD new_access_method + SET TABLESPACE new_tablespace SET ( storage_parameter [= value] [, ... ] ) RESET ( storage_parameter [, ... ] ) OWNER TO { new_owner | CURRENT_ROLE | CURRENT_USER | SESSION_USER } diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c index 6957567264..daf4206caa 100644 --- a/src/bin/psql/tab-complete.c +++ b/src/bin/psql/tab-complete.c @@ -2124,7 +2124,7 @@ psql_completion(const char *text, int start, int end) COMPLETE_WITH("TO"); /* ALTER MATERIALIZED VIEW xxx SET */ else if (Matches("ALTER", "MATERIALIZED", "VIEW", MatchAny, "SET")) - COMPLETE_WITH("(", "SCHEMA", "TABLESPACE", "WITHOUT CLUSTER"); + COMPLETE_WITH("(", "ACCESS METHOD", "SCHEMA", "TABLESPACE", "WITHOUT CLUSTER"); /* ALTER POLICY */ else if (Matches("ALTER", "POLICY")) COMPLETE_WITH_QUERY(Query_for_list_of_policies); @@ -2485,6 +2485,13 @@ psql_completion(const char *text, int start, int end) else if (Matches("ALTER", "TYPE", MatchAny, "RENAME", "VALUE")) COMPLETE_WITH_ENUM_VALUE(prev3_wd); + /* + * If we have ALTER MATERIALIZED VIEW SET ACCESS METHOD provide a list of table + * AMs. + */ + else if (Matches("ALTER", "MATERIALIZED", "VIEW", MatchAny, "SET", "ACCESS", "METHOD")) + COMPLETE_WITH_QUERY(Query_for_list_of_table_access_methods); + /* * ANALYZE [ ( option [, ...] ) ] [ table_and_columns [, ...] ] * ANALYZE [ VERBOSE ] [ table_and_columns [, ...] ] --Multipart=_Wed__16_Mar_2022_13_33_37_+0900_KaEvUkjzJegHt0vC--