pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Misplaced double quotes in error message
5+ messages / 5 participants
[nested] [flat]

* Misplaced double quotes in error message
@ 2021-10-07 06:17  Thomas Kellerer <shammat@gmx.net>
  0 siblings, 1 reply; 5+ messages in thread

From: Thomas Kellerer @ 2021-10-07 06:17 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>

Hello,

consider the following table, query and error message:

    create table t
    (
      "someColumn" int
    );

    select t.someColumn
    from t;


    ERROR: column t.somecolumn does not exist
      Hint: Perhaps you meant to reference the column "t.someColumn".


For someone proficient in SQL it's pretty clear what the error message means,
but the quotes can be misleading for someone who doesn't really understand
what's going on.

I think if the error message quoted the column name the way it should actually
be used, it would make things easier for someone not used to this, e.g.:

      Hint: Perhaps you meant to reference the column t."someColumn".

Because when the user takes the error message literally they might be tempted
to use "t.someColumn" just to be confronted with the same error message again
which then seems even more confusing.








^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Misplaced double quotes in error message
@ 2021-10-07 13:39  Adrian Klaver <adrian.klaver@aklaver.com>
  parent: Thomas Kellerer <shammat@gmx.net>
  0 siblings, 2 replies; 5+ messages in thread

From: Adrian Klaver @ 2021-10-07 13:39 UTC (permalink / raw)
  To: Thomas Kellerer <shammat@gmx.net>; pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>

On 10/6/21 11:17 PM, Thomas Kellerer wrote:
> Hello,
> 
> consider the following table, query and error message:
> 
>      create table t
>      (
>        "someColumn" int
>      );
> 
>      select t.someColumn
>      from t;
> 
> 
>      ERROR: column t.somecolumn does not exist
>        Hint: Perhaps you meant to reference the column "t.someColumn".
> 
> 
> For someone proficient in SQL it's pretty clear what the error message means,
> but the quotes can be misleading for someone who doesn't really understand
> what's going on.

FYI, errors are generically double quoted:

ERROR:  invalid input syntax for type integer: "one"

This is not specific to identifier quoting.

> 
> I think if the error message quoted the column name the way it should actually
> be used, it would make things easier for someone not used to this, e.g.:
> 
>        Hint: Perhaps you meant to reference the column t."someColumn".
> 
> Because when the user takes the error message literally they might be tempted
> to use "t.someColumn" just to be confronted with the same error message again
> which then seems even more confusing.
> 
> 
> 
> 
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Misplaced double quotes in error message
@ 2021-10-07 13:52  Sunil Thakur <smthakur19@gmail.com>
  parent: Adrian Klaver <adrian.klaver@aklaver.com>
  1 sibling, 0 replies; 5+ messages in thread

From: Sunil Thakur @ 2021-10-07 13:52 UTC (permalink / raw)
  To: Adrian Klaver <adrian.klaver@aklaver.com>; +Cc: Thomas Kellerer <shammat@gmx.net>; pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>

It means
Error thrown by Postgres: Hint: Perhaps you meant to reference the column
"t.someColumn".
must be Hint: Perhaps you meant to reference the column t."someColumn".


*Thanks and Regards,Sunil M. K. Thakur*
<https://www.linkedin.com/in/smthakur19; *
<https://twitter.com/smthakur19;  <https://www.facebook.com/smthakur19>*


On Thu, 7 Oct 2021 at 19:09, Adrian Klaver <adrian.klaver@aklaver.com>
wrote:

> On 10/6/21 11:17 PM, Thomas Kellerer wrote:
> > Hello,
> >
> > consider the following table, query and error message:
> >
> >      create table t
> >      (
> >        "someColumn" int
> >      );
> >
> >      select t.someColumn
> >      from t;
> >
> >
> >      ERROR: column t.somecolumn does not exist
> >        Hint: Perhaps you meant to reference the column "t.someColumn".
> >
> >
> > For someone proficient in SQL it's pretty clear what the error message
> means,
> > but the quotes can be misleading for someone who doesn't really
> understand
> > what's going on.
>
> FYI, errors are generically double quoted:
>
> ERROR:  invalid input syntax for type integer: "one"
>
> This is not specific to identifier quoting.
>
> >
> > I think if the error message quoted the column name the way it should
> actually
> > be used, it would make things easier for someone not used to this, e.g.:
> >
> >        Hint: Perhaps you meant to reference the column t."someColumn".
> >
> > Because when the user takes the error message literally they might be
> tempted
> > to use "t.someColumn" just to be confronted with the same error message
> again
> > which then seems even more confusing.
> >
> >
> >
> >
> >
>
>
> --
> Adrian Klaver
> adrian.klaver@aklaver.com
>
>
>

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Misplaced double quotes in error message
@ 2021-10-07 14:55  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Adrian Klaver <adrian.klaver@aklaver.com>
  1 sibling, 1 reply; 5+ messages in thread

From: Tom Lane @ 2021-10-07 14:55 UTC (permalink / raw)
  To: Adrian Klaver <adrian.klaver@aklaver.com>; +Cc: Thomas Kellerer <shammat@gmx.net>; pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>

Adrian Klaver <adrian.klaver@aklaver.com> writes:
> On 10/6/21 11:17 PM, Thomas Kellerer wrote:
>> consider the following table, query and error message:
>> ERROR: column t.somecolumn does not exist
>> Hint: Perhaps you meant to reference the column "t.someColumn".
>> 
>> For someone proficient in SQL it's pretty clear what the error message means,
>> but the quotes can be misleading for someone who doesn't really understand
>> what's going on.

> FYI, errors are generically double quoted:
> ERROR:  invalid input syntax for type integer: "one"
> This is not specific to identifier quoting.

Yeah.  This is not as simple as it looks, because per our message
style guidelines, double quotes are used to set off inserted text,
independently of whether it is a SQL identifier or something else.
(There is a style violation in this message: the occurrence of
t.somecolumn in the primary message should've been quoted too.)

In translated error messages, the English double quotes are replaced
with whatever the common quoting marks are in that language.  So
for instance in French this becomes

ASTUCE :  Peut-être que vous souhaitiez référencer la colonne « t.someColumn ».

where it's at least clearer that the set-off marks are not meant to be
copied into a SQL statement.

In short, what we've got here is unfortunate confusion between the meaning
of double quotes in ordinary English and their meaning in SQL.  People
complain about this topic every so often, but I've not yet seen a proposal
that would improve matters.

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Misplaced double quotes in error message
@ 2021-10-07 20:14  Peter J. Holzer <hjp-pgsql@hjp.at>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 5+ messages in thread

From: Peter J. Holzer @ 2021-10-07 20:14 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

On 2021-10-07 10:55:09 -0400, Tom Lane wrote:
> Yeah.  This is not as simple as it looks, because per our message
> style guidelines, double quotes are used to set off inserted text,
> independently of whether it is a SQL identifier or something else.
> (There is a style violation in this message: the occurrence of
> t.somecolumn in the primary message should've been quoted too.)
> 
> In translated error messages, the English double quotes are replaced
> with whatever the common quoting marks are in that language.  So
> for instance in French this becomes
> 
> ASTUCE :  Peut-être que vous souhaitiez référencer la colonne « t.someColumn ».
> 
> where it's at least clearer that the set-off marks are not meant to be
> copied into a SQL statement.
> 
> In short, what we've got here is unfortunate confusion between the meaning
> of double quotes in ordinary English and their meaning in SQL.  People
> complain about this topic every so often, but I've not yet seen a proposal
> that would improve matters.

You could use proper typographic quotes in English, too:

    ERROR: column “t.somecolumn” does not exist
    Hint: Perhaps you meant to reference the column “t.someColumn”.

But that's optically not very different (depends on your font, of
course) and your terminal has to support Unicode (or at least a subset
which includes those quotes).

        hp

-- 
   _  | Peter J. Holzer    | Story must make more sense than reality.
|_|_) |                    |
| |   | hjp@hjp.at         |    -- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |       challenge!"

Attachments:

  signature.asc (application/pgp-signature, 832B) download

^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2021-10-07 20:14 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-10-07 06:17 Misplaced double quotes in error message Thomas Kellerer <shammat@gmx.net>
2021-10-07 13:39 ` Adrian Klaver <adrian.klaver@aklaver.com>
2021-10-07 13:52   ` Sunil Thakur <smthakur19@gmail.com>
2021-10-07 14:55   ` Tom Lane <tgl@sss.pgh.pa.us>
2021-10-07 20:14     ` Peter J. Holzer <hjp-pgsql@hjp.at>

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