Re: \dt shows table but \d <table> says the table doesn't exist ?

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: jian he <jian(dot)universality(at)gmail(dot)com>, Magnus Hagander <magnus(at)hagander(dot)net>, David Gauthier <dfgpostgres(at)gmail(dot)com>, "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: \dt shows table but \d <table> says the table doesn't exist ?
Date: 2024-05-04 04:22:55
Message-ID: 8a888f00-3752-463e-87c6-bb3979c7a4b8@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 5/3/24 21:06, David G. Johnston wrote:
> On Friday, May 3, 2024, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us
> <mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us>> wrote:
>
>
> By and large, I'd expect people using mixed-case table names to get
> accustomed pretty quickly to the fact that they have to double-quote
> those names in SQL.  I don't see why it's a surprise that that is also
> true in \d commands.
>
>
> Every day the number of people increases who get mixed-case names in
> their DB because their client language preserves case and doesn’t
> require quoting.

In a sense they do by making quoting the default, which people find out
when they stray from the language/ORM/framework and get pointed at:

https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS

>
> And it isn’t like any sane person is using case to distinguish names in
> their DB and so would be at risk of seeing multiple unwanted matches for
> any given pattern.

Have you met people?

>
> I don’t think name pattern matching during object lookup is a good tool
> to wield to try and convince people that using camel case is a bad idea
> and they should use snake case instead.  If they don’t write enough raw
> SQL to be annoyed by their choice more power to them, making \d more
> accessible for them is a win and snake case people won’t notice or care.
>
> David J.

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2024-05-04 04:47:23 Re: \dt shows table but \d <table> says the table doesn't exist ?
Previous Message Tom Lane 2024-05-04 04:14:23 Re: \dt shows table but \d <table> says the table doesn't exist ?