pg.ddx.io pgsql-general@postgresql.org mailing list archivehelp / color / mirror / Atom feed
From: Andreas 'ads' Scherbaum <ads@pgug.de>
To: pgsql-general@lists.postgresql.org
Subject: Re: Can we go beyond the standard to make Postgres radically better?
Date: Sat, 12 Feb 2022 22:09:25 +0100
Message-ID: <ade50b0c-a69e-3d8d-3f70-52363fff24ae@pgug.de> (raw)
In-Reply-To: <20220212195057.amvpuhytkkcndyhh@hjp.at>
References: <7117322c-185c-4283-990d-6646d8476409@Spark>
<F04BD036-073C-42AD-B308-43D21C75024B@gmail.com>
<20220210172229.4it7ioddvrtmws37@hjp.at>
<eafc22b5-703d-2993-b4bc-4edad404f63f@pgug.de>
<20220212195057.amvpuhytkkcndyhh@hjp.at>
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:
>>>>
>>>> • SELECT * - b.a_id from a natural join b
>>> 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).
>> Maybe for this specific use case it's easier to teach psql how to do that,
>> instead of trying to amend the SQL implementation? Example:
>>
>> SELECT * \- col1 \- col2 FROM table
>>
>> psql looks up the columns, translates * into the actual list minus these two
>> columns and lets you continue entering the query.
> I think the easiest way to get the columns would be to EXPLAIN(verbose)
> the query. Otherwise psql (or whatever your shell is) would have to
> completely parse the SQL statement to find the columns.
>
> (On a tangent, I'm wondering if this could work for autocomplete. The
> problem with autocomplete is of course that you probably don't have
> a syntactically correct query at the time you need it. So the editor
> would have to patch that up before sending it to the database.)
I was thinking about this problem for a while, and it's not easy to solve.
Hence I came up with the idea that psql could - once the table is known
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 user you
can edit the column list further.
The main concern listed further upstream is "surfing the database", in
interactive mode. Not the first time I hear this problem.
Solving this specific case might reduce the need for a SQL extenson.
Note: the attempt above is just an idea, not an actual proposal how to
implement this.
Regards,
--
Andreas 'ads' Scherbaum
German PostgreSQL User Group
European PostgreSQL User Group - Board of Directors
Volunteer Regional Contact, Germany - PostgreSQL Project
view thread (50+ messages) latest in thread
Message-ID: <ade50b0c-a69e-3d8d-3f70-52363fff24ae@pgug.de> Permalink: ../ade50b0c-a69e-3d8d-3f70-52363fff24ae@pgug.de/ Also on: postgresql.org/message-id/ade50b0c-a69e-3d8d-3f70-52363fff24ae@pgug.de ·
reply
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Reply to all the recipients from your mail client; the link fills in the headers below: reply via email Some clients, webmail especially, drop In-Reply-To and References from a link, and the reply then starts a new thread: use the mbox below. To: pgsql-general@postgresql.org Cc: ads@pgug.de Subject: Re: Can we go beyond the standard to make Postgres radically better? In-Reply-To: <ade50b0c-a69e-3d8d-3f70-52363fff24ae@pgug.de> References: <7117322c-185c-4283-990d-6646d8476409@Spark> <F04BD036-073C-42AD-B308-43D21C75024B@gmail.com> <20220210172229.4it7ioddvrtmws37@hjp.at> <eafc22b5-703d-2993-b4bc-4edad404f63f@pgug.de> <20220212195057.amvpuhytkkcndyhh@hjp.at> <ade50b0c-a69e-3d8d-3f70-52363fff24ae@pgug.de> * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox