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 1nIW6M-0006wQ-37 for pgsql-general@arkaria.postgresql.org; Fri, 11 Feb 2022 13:36:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nIW6L-0002jT-0R for pgsql-general@arkaria.postgresql.org; Fri, 11 Feb 2022 13:36:41 +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 1nIW6K-0002jK-MO for pgsql-general@lists.postgresql.org; Fri, 11 Feb 2022 13:36:40 +0000 Received: from verite.pro ([195.154.133.58] helo=sd-76392.dedibox.fr) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nIW6H-0007H0-DY for pgsql-general@lists.postgresql.org; Fri, 11 Feb 2022 13:36:40 +0000 Received: by sd-76392.dedibox.fr (Postfix, from userid 1000) id 03A4A2240245; Fri, 11 Feb 2022 14:35:34 +0100 (CET) Content-Type: text/plain; charset="iso-8859-15" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: Can we go beyond the standard to make Postgres radically better? From: "Daniel Verite" To: "Peter J. Holzer" Cc: pgsql-general@lists.postgresql.org In-Reply-To: <20220210172545.f7vtdcrg325v3xlx@hjp.at> Date: Fri, 11 Feb 2022 14:35:33 +0100 Message-Id: <2acec54b-4491-4f5a-aa48-4d4cda72b302@manitou-mail.org> X-Mailer: Manitou v1.7.3 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Peter J. Holzer wrote: > > My use case for such a feature are tables which contain one column (or a > > small number of columns) which you usually don't want to select: A bytea > > column or a very wide text column. In a program I don't mind (in fact I > > prefer) listing all the columns explicitely, but exploring a database > > interactively with psql typing lots of column names is tedious > > (especially since autocomplete doesn't work here). >=20 > Forgot to add: I think that the syntax would have to be more explicit. > It's too easy to mix up > SELECT * - b.a_id FROM ... > and > SELECT *, - b.a_id FROM ... >=20 > Maybe > SELECT * EXCEPT b.a_id FROM ... The solution to this by the SQL standard might be that it can be done with a Polymorphic Table Function, introduced in SQL:2016. https://webstore.iec.ch/preview/info_isoiec19075-7%7Bed1.0%7Den.pdf A practical example with the Oracle implementation can be seen here: https://blogs.oracle.com/sql/post/select-star-except-queries-in-oracle-data= base Excluding all columns of a given type from a relation is also possible, with both the relation and the type as parameters of the PTF. Best regards, --=20 Daniel V=E9rit=E9 PostgreSQL-powered mailer: https://www.manitou-mail.org Twitter: @DanielVerite