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 1s6Yha-000Jru-Gw for pgsql-hackers@arkaria.postgresql.org; Mon, 13 May 2024 16:39:04 +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 1s6Yha-002HNT-Lv for pgsql-hackers@arkaria.postgresql.org; Mon, 13 May 2024 16:39:02 +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 1s6YeW-002CdS-4E for pgsql-hackers@lists.postgresql.org; Mon, 13 May 2024 16:35:52 +0000 Received: from wfhigh2-smtp.messagingengine.com ([64.147.123.153]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s6YeR-0002P1-VR for pgsql-hackers@postgresql.org; Mon, 13 May 2024 16:35:51 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailfhigh.west.internal (Postfix) with ESMTP id BDA81180011A; Mon, 13 May 2024 12:35:45 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Mon, 13 May 2024 12:35:46 -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=1715618145; x=1715704545; bh=dZrDx8OQnl mS09zwpDszOuMQEUmsNY+dzlYZBAj9xBE=; b=lAXMv9SJz+PVlNkjKxXbmPd4WU tldNMb3lXxfNoXqoD97iR6UJvpfW2C7olEqxs1w39nk4Bi8zzgEuIOUVPe8qsYGN xk6MwIokEDkQ+2DYrBi3XONuiEBMWov/vIJByPYm1EYXAd0U7yRmTmsGOGU/neBl UounoP7EBB6yOJ+nlm9Q92TW7EqS0yrGaQFvZUIlXoL/VLiZG2XBxcRwkG3ukWcZ M4Vn893nlqUBYz/00Dj7iBjkSok/CIGy7RTsU418Y47ixbL6JjOCWYvod/joufVF hB9ZGtW6banEZ5EgLMfJcg0Mox+RBfjnaPQ0dq2pwPks0hWz+eqhL07Kdusg== 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=1715618145; x=1715704545; bh=dZrDx8OQnlmS09zwpDszOuMQEUms NY+dzlYZBAj9xBE=; b=OIx0IgyX1uBqeiP93CbygbN60kbOtAHrshg9GRtv8hqV B506b2yZwlICADpdJ388usIiGrwLk9ynqOGqWSDJ6XFGzcJUH2hfVfl27YBEoYkZ FcSv2+EzHeOfyAER9uNenEPPox+Jiz7GZNDrymfiQgSWWi+vUY+Y5PxFSBp1nO2B UN2tWZCC7oYJsBWJ+oFoKSp5C8cfNfA4QH5uFuIXhtRwEMY2LZT4wzcBJNIBJhpH dzMHrFIma6cEagbjKe3FhyyOlk95pCFK42U07x09eU7lftGhr9Fi1mLaCyY3wr4c iLv0ErtABCXJAzTiv9x++Jo0mECg92JGEwUTBh7WEA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvdeggedguddtudcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhvfevufhfffgjkfgfgggtsehttdertddtreejnecuhfhrohhmpeffrghg fhhinhhnucfklhhmrghrihcuofgrnhhnshonkhgvrhcuoehilhhmrghrihesihhlmhgrrh hirdhorhhgqeenucggtffrrghtthgvrhhnpeekleejueefhfffkefhkedtfeeluedvieei hfehfeeffeeggeduffduheejjeeigfenucevlhhushhtvghrufhiiigvpedtnecurfgrrh grmhepmhgrihhlfhhrohhmpehilhhmrghrihesihhlmhgrrhhirdhorhhg X-ME-Proxy: Feedback-ID: i1ff147bf:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 13 May 2024 12:35:44 -0400 (EDT) From: =?utf-8?Q?Dagfinn_Ilmari_Manns=C3=A5ker?= To: Tom Lane Cc: Matthias van de Meent , Artur Formella , pgsql-hackers@postgresql.org Subject: Re: Allowing additional commas between columns, and at the end of the SELECT clause References: <0368c60f-abe2-4f5f-972d-7cd1e6db2382@gmail.com> <87bk59hp5o.fsf@wibble.ilmari.org> <738732.1715609494@sss.pgh.pa.us> Date: Mon, 13 May 2024 17:35:42 +0100 In-Reply-To: <738732.1715609494@sss.pgh.pa.us> (Tom Lane's message of "Mon, 13 May 2024 10:11:34 -0400") Message-ID: <877cfxhdpd.fsf@wibble.ilmari.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Tom Lane writes: > =?utf-8?Q?Dagfinn_Ilmari_Manns=C3=A5ker?= writes: >> Matthias van de Meent writes: >>> Single trailing commas are a feature that's more and more common in >>> languages, yes, but arbitrary excess commas is new to me. Could you >>> provide some examples of popular languages which have that, as I can't >>> think of any. > >> The only one I can think of is Perl, which I'm not sure counts as >> popular any more. JavaScript allows consecutive commas in array >> literals, but they're not no-ops, they create empty array slots: > > I'm fairly down on this idea for SQL, because I think it creates > ambiguity for the ROW() constructor syntax. That is: > > (x,y) is understood to be shorthand for ROW(x,y) > > (x) is not ROW(x), it's just x > > (x,) means what? Python has a similar issue: (x, y) is a tuple, but (x) is just x, and they use the trailing comma to disambiguate, so (x,) creates a single-item tuple. AFAIK it's the only place where the trailing comma is significant. > I realize the original proposal intended to restrict the legality of > excess commas to only a couple of places, but to me that just flags > it as a kluge. ROW(...) ought to work pretty much the same as a > SELECT list. Yeah, a more principled approach would be to not special-case target lists, but to allow one (and only one) trailing comma everywhere: select, order by, group by, array constructors, row constructors, everything that looks like a function call, etc. > As already mentioned, if you can get some variant of this through the > SQL standards process, we'll probably adopt it. But I doubt that we > want to get out front of the committee in this area. Agreed. > regards, tom lane - ilmari