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 1nJAG8-0004iO-SH for pgsql-general@arkaria.postgresql.org; Sun, 13 Feb 2022 08:29:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nJAG7-0006mS-Cv for pgsql-general@arkaria.postgresql.org; Sun, 13 Feb 2022 08:29:27 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nJAG7-0006mJ-2J for pgsql-general@lists.postgresql.org; Sun, 13 Feb 2022 08:29:27 +0000 Received: from mail.hjp.at ([212.17.106.138] helo=rorschach.hjp.at) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nJAFw-0000Zp-RK for pgsql-general@lists.postgresql.org; Sun, 13 Feb 2022 08:29:25 +0000 Received: by rorschach.hjp.at (Postfix, from userid 1000) id 431C963BD; Sun, 13 Feb 2022 09:29:14 +0100 (CET) Date: Sun, 13 Feb 2022 09:29:14 +0100 From: "Peter J. Holzer" To: pgsql-general@lists.postgresql.org Subject: Re: Can we go beyond the standard to make Postgres radically better? Message-ID: <20220213082914.zet7f5ojb4z2laov@hjp.at> Mail-Followup-To: pgsql-general@lists.postgresql.org References: <7117322c-185c-4283-990d-6646d8476409@Spark> <20220210172229.4it7ioddvrtmws37@hjp.at> <20220212195057.amvpuhytkkcndyhh@hjp.at> <20220212213453.tordj3445pgyxonq@hjp.at> <3a50f4fb-3b62-cd5c-a60c-a7211c7f7a5e@pgug.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="xcrcabys7wglk3xz" Content-Disposition: inline In-Reply-To: <3a50f4fb-3b62-cd5c-a60c-a7211c7f7a5e@pgug.de> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --xcrcabys7wglk3xz Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2022-02-13 01:11:16 +0100, Andreas 'ads' Scherbaum wrote: > On 12/02/2022 22:34, Peter J. Holzer wrote: > > On 2022-02-12 22:09:25 +0100, Andreas 'ads' Scherbaum wrote: > > > On 12/02/2022 20:50, Peter J. Holzer wrote: > > > > On 2022-02-12 01:18:04 +0100, Andreas 'ads' Scherbaum wrote: > > > > > On 10/02/2022 18:22, Peter J. Holzer wrote: > > > > > > On 2022-02-09 21:14:39 -0800, Guyren Howe wrote: > > > > > > > Examples of small things Postgres could have: > > > > > > >=20 > > > > > > > =E2=80=A2 SELECT * - b.a_id from a natural join b > > [...] > > > > > Maybe for this specific use case it's easier to teach psql how to= do that, > > [...] > > > > I think the easiest way to get the columns would be to EXPLAIN(verb= ose) > > > > the query. Otherwise psql (or whatever your shell is) would have to > > > > completely parse the SQL statement to find the columns. [...] > > > I was thinking about this problem for a while, and it's not easy to s= olve. > > > Hence I came up with the idea that psql could - once the table is kno= wn > > > and very specific psql syntax is there (\- as example) replace the * = with > > > the actual columns. All of this before the query is run, and as a use= r you > > > can edit the column list further. > > Yeah, but the problem is that it isn't that easy for psql to figure out > > which table is involved. >=20 > The complaint is not about complex queries, or CTEs, or Joins. This is > about simple queries where a user wants to discover - surf - the database > and look into specific tables, but exclude certain columns. If you look back through this thread you will notice that it was me who brought up that specific scenario. You might trust me to know what I was thinking about when I wrote it ;-). > More specifically, this is when the user types in interactive queries. I do write quite complex queries interactively. Even when "surfing", joins are common because in a normalized schema many columns just contain meaningless foreign keys. But I also do some data analysis interactively (which is where CTEs usually come in) and I like to develop queries interactively before putting them into (Python) programs. But even if I didn't do that - if you add a feature like that to psql, it should work for all queries, not just a tiny subset. > Today psql tries to do autocomplete for certain scenarios, this too does > not work in complex queries, but nevertheless is a useful help if someone > tries to run simple, interactive queries. Autocomplete doesn't even work well for simple queries. It's better than nothing, but I don't think that it should serve as a model for new features. hp --=20 _ | Peter J. Holzer | Story must make more sense than reality. |_|_) | | | | | hjp@hjp.at | -- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | challenge!" --xcrcabys7wglk3xz Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEETtJbRjyPwVTYGJ5k8g5IURL+KF0FAmIIwVUACgkQ8g5IURL+ KF3McQ//dGNCXM2cyjjhdbdGxbh8uoekGUcT9sAN2iaitdM8llL+T6qsx6QDeXld yALSG+FwwX1mO2CFZJhxX0cUS1y7O60+PbkQ+ehj3HSGAaC9jTotkk9EuhVz5Eue UulUGVpq4FZcU5ycW1Gl2mJdemCa0Xxf9qy/eQ62OW+FBRSlSz8G0kfiignD4oKl yygGQ3v9kCOgK/112Obw5GxTRcDyQMgyex1QWfKk/puBVf5lo4GlXJdeAwwBTcec ute50s9iATZLzIIuV8mCm6XuD+UgL13p/6ZEiAwvP5ijacLOF5kUZe+Pz0d4m0I3 jKeH+qm3b6V6tErsLrdKuahHDij9mmUJuBGcvPXjZWWUn8zcuzIo5LuSokptDl20 KEjCo5xwr+K5YHwnohDyo8yFAlCG8JweNJmrA9/hFC27qO0PhdvJbANBHRstXl/a roZW38qTBSzRT6OpvRT6ILCsY4Bmo7CNqgBYlDq7KY2rBJyD6yQmBVrPaSMZX1mH O2zzY7qknmuuhoxLgKwyg/HvsqCJKXABgj/q8tG7T134nl80hFsAQa8vy3UlsO3W m28XbxNlQqMd6/DW7rjKkQvj1HLpSoeyO4JijknnMLF408Wghzketwgfysmd07s9 B4/ZjXd7s/NYDHR3P8z/ScrNP2ZqeJFZRHBBgKH4yH9ES4f/MTc= =qH0c -----END PGP SIGNATURE----- --xcrcabys7wglk3xz--