Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ci9t4-0008KH-Kq for pgsql-hackers@arkaria.postgresql.org; Mon, 27 Feb 2017 01:14:02 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1ci9t3-0003wu-Nm for pgsql-hackers@arkaria.postgresql.org; Mon, 27 Feb 2017 01:14:01 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ci9rZ-0001IW-Qp for pgsql-hackers@postgresql.org; Mon, 27 Feb 2017 01:12:29 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ci9rW-0004h4-Uv for pgsql-hackers@postgresql.org; Mon, 27 Feb 2017 01:12:29 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id v1R1CNZe001323; Sun, 26 Feb 2017 20:12:23 -0500 From: Tom Lane To: Michael Paquier cc: Robert Haas , Pavel Stehule , Kyotaro HORIGUCHI , PostgreSQL Hackers Subject: Re: IF (NOT) EXISTS in psql-completion In-reply-to: References: <20170203.171712.150614683.horiguchi.kyotaro@lab.ntt.co.jp> <20170214.195152.59283261.horiguchi.kyotaro@lab.ntt.co.jp> <19657.1488140516@sss.pgh.pa.us> Comments: In-reply-to Michael Paquier message dated "Mon, 27 Feb 2017 09:52:03 +0900" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1321.1488157943.1@sss.pgh.pa.us> Date: Sun, 26 Feb 2017 20:12:23 -0500 Message-ID: <1322.1488157943@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Michael Paquier writes: > On Mon, Feb 27, 2017 at 5:21 AM, Tom Lane wrote: >> So I'd be a whole lot happier if it didn't do that. Can we really not >> add the desired features in a more localized fashion? > As "if not exists" is defined after the object type if would not be > that complicated to add completion for IE/INE after the object type > with a set of THING_* flags in words_after_create. One missing piece > would be to add completion for the objects themselves after IE or INE > have been entered by the user, but I would think that tweaking the > checks on words_after_create[i] would be doable as well. And that > would be localized. BTW ... can anyone explain to me the reason why we offer to complete CREATE OBJECT with the names of existing objects of that kind? That seems pretty darn stupid. I can see offering the names of existing schemas there, if the object type is one that has schema-qualified names, but completing with an existing object name is just setting up to fail isn't it? If we dropped that behavior, seems like it would become much easier to plug in IF NOT EXISTS at those spots. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers