Re: DWIM mode for psql

From: Amit Langote <amitlangote09(at)gmail(dot)com>
To: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: DWIM mode for psql
Date: 2019-04-01 01:12:28
Message-ID: CA+HiwqELsCSYx5c0DxrsERziROUuUnpmwXOYWC3aNjiYi2cktQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Thomas,

Thanks for working on this.

On Mon, Apr 1, 2019 at 5:53 Thomas Munro <thomas(dot)munro(at)gmail(dot)com> wrote:

Hello,
>
> Building on the excellent work begun by commit e529cd4ffa60, I would
> like to propose a do-what-I-mean mode for psql. Please find a POC
> patch attached. It works like this:
>
> postgres=# select datnaam from pg_database where ooid = 12917;
> ERROR: column "datnaam" does not exist
> LINE 1: select datnaam from pg_database where ooid = 12917;
> ^
> HINT: Perhaps you meant to reference the column "pg_database.datname".
> postgres=# YES
> datname
> ----------
> postgres
> (1 row)
>
> As you can see, by "shouting" a new keyword at the computer, it will
> take its own hint and run the corrected query. To avoid having to do
> this in two steps, you can also shout the whole query for the same
> effect:
>
> postgres=# SELECT DATNAAM FROM PG_DATABASE WHERE OOID = 12917;
> datname
> ----------
> postgres
> (1 row)

Neat.

The next version will be able to fix permissions problems and override
> errors automatically as follows, though that is proving trickier to
> get working. Example:
>
> postgres=# SUDO DROP TABLE PG_DATABASS;
> NO CARRIER

Have you tried rebooting the machine?

Thanks,
Amit

>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Nagaura, Ryohei 2019-04-01 01:46:16 RE: Timeout parameters
Previous Message David Rowley 2019-04-01 00:24:56 Re: speeding up planning with partitions