Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b5u8C-0005qc-Rx for pgsql-hackers@arkaria.postgresql.org; Thu, 26 May 2016 12:11:17 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1b5u8B-00052S-GO for pgsql-hackers@arkaria.postgresql.org; Thu, 26 May 2016 12:11:15 +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 1b5u6o-0003T9-Da for pgsql-hackers@postgresql.org; Thu, 26 May 2016 12:09:51 +0000 Received: from newmail.postgrespro.ru ([93.174.131.138] helo=mail.postgrespro.ru) by magus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b5u6g-0005LQ-41 for pgsql-hackers@postgresql.org; Thu, 26 May 2016 12:09:49 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id 0953E21C886F; Thu, 26 May 2016 15:09:40 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at postgrespro.ru Received: from mail.postgrespro.ru ([127.0.0.1]) by localhost (mail.postgrespro.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hsZrysLt0I9x; Thu, 26 May 2016 15:09:38 +0300 (MSK) Received: from nataraj-amd64.localnet (unknown [192.168.27.1]) by mail.postgrespro.ru (Postfix) with ESMTPSA id 57D8721C8831; Thu, 26 May 2016 15:09:38 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1464264578; bh=iyQryRUG4ThJK1mTYbMkoWlgObljcNHgUCzEzD/7DCE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=hfFBppqvRyPDh7gv54phWOoXGx5eZAXkFITMGtedtDWccvjYsevDtdJ7OdTw+ZqqB 8Xim2nRKDj/e2feNvQhaNAN0AYtZhrbvJmIDeguN4IRB/xRiHjgyTZVVn+I7RVYk5L u8wmRoJg0yXI20+ZXz4GjYOEn4tKZHzoY2vfScEI= From: Nikolay Shaplov To: Tom Lane Cc: pgsql-hackers@postgresql.org Subject: Re: [PATCH][Documination] Add optional USING keyword before opclass name in INSERT statemet Date: Thu, 26 May 2016 15:09:38 +0300 Message-ID: <1868585.jcgsxskSny@nataraj-amd64> User-Agent: KMail/4.14.1 (Linux/3.16.0-4-amd64; KDE/4.14.2; x86_64; ; ) In-Reply-To: <2196.1464108440@sss.pgh.pa.us> References: <1593237.l7oKHRpxSe@nataraj-amd64> <2196.1464108440@sss.pgh.pa.us> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" X-Pg-Spam-Score: -3.4 (---) 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 =D0=92 =D0=BF=D0=B8=D1=81=D1=8C=D0=BC=D0=B5 =D0=BE=D1=82 24 =D0=BC=D0=B0=D1= =8F 2016 12:47:20 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D0= =B5=D0=BB=D1=8C Tom Lane =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB: > Nikolay Shaplov writes: > > If I read gram.y code for insert statement, I see that there is an > > optional > > USING keyword before opclass name > >=20 > > opt_class: any_name { $$ =3D $1; } > >=20 > > | USING any_name { $$ =3D $2; } > > | /*EMPTY*/ { $$ =3D NIL; } > >=20=20=20=20=20=20=20=20=20 > > ; > >=20 > > but it the documentation this keyword is omitted. >=20 > I think we should seriously consider fixing this code/docs discrepancy > by making the code match the docs, not vice versa. That is, let's just > remove the USING alternative here entirely. >=20 > If we wanted to make the docs match the code, it would not only be > CREATE INDEX that would have to be patched, because that's not the > only place that index_elem can appear. As far as I can find in a > quick search, none of the relevant statements have ever documented > that USING is allowed here; nor does it appear that any client-side > code of ours makes use of the keyword. >=20 > Also, because USING is already used elsewhere in CREATE INDEX (to > introduce the optional index AM name), I think that documenting its > use in this clause would add confusion not subtract it. References > to "the USING clause in CREATE INDEX" would become ambiguous. >=20 > This wouldn't be something to back-patch, of course, but I think it's > an entirely reasonable change to make in HEAD. >=20 > Comments? I have two arguments for not removing USING there.=20 1. Backward compatibility. Are you sure, that nobody ever wrote a code usin= g=20 this "USING" keyword? I would say it is unlikely, but will not be sure 100%= .=20 Dropping this backward compatibility (even with small chance that it was ev= er=20 used) for no practical reason is not wise at all. If it might bring some pa= in=20 to somebody, then why do it after all... 2. I think expression with USING in it is more human readable: CREATE INDEX (xxx op_yyy); is less sensible then=20 CREATE INDEX (xxx USING op_yyy); in my opinion. In second example person that does not know SQL at all, will= =20 understand that xxx is main object or action, and op_yyy is about how this = xxx=20 will be done or used. If somebody would like to write more readable code, why we should forbid it= to=20 him? 2.1. As far as I can get the general idea of SQL, there is a tendency to pu= t=20 keywords (optional or not) between to object names. Like this SELECT a _AS_ b from .... I like this tendency 2.2. I am not familiar with SQL ISO standart, and I suppose there is no USI= NG=20 at all in that case, but I think it would be good to look there to check fo= r=20 it or for something similar 2.3. And the last, when I found out about this keyword, I started to use it= in=20 my SQL statements that I use while development, and I just liked it. I will= =20 miss it if you remove it ;-)=20 --=20 Nikolay Shaplov Postgres Professional: http://www.postgrespro.com Russian Postgres Company --=20 Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers