agora inbox for pgsql-docs@postgresql.org
help / color / mirror / Atom feedFrom: Bruce Momjian <bruce@momjian.us>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Ken Harris <kengruven@gmail.com>
Cc: David G. Johnston <david.g.johnston@gmail.com>
Cc: pgsql-docs@lists.postgresql.org <pgsql-docs@lists.postgresql.org>
Subject: Re: Shadowing type names because I am not smart
Date: Thu, 20 Aug 2026 17:31:52 -0400
Message-ID: <aodySMS-W9W0jFKv@momjian.us> (raw)
In-Reply-To: <1815772.1785553121@sss.pgh.pa.us>
References: <178536354641.1228.15444395280389125710@wrigleys.postgresql.org>
<CAKFQuwa7Wh-Ufei1VWx_ELbCjrv1kWvrNW=Bqu9B15j2x7QmOQ@mail.gmail.com>
<CALoxLVqkoyftSiLCqsPAb40V5XXZm+YbvBgx0abD+q7wwu_yOA@mail.gmail.com>
<1815772.1785553121@sss.pgh.pa.us>
On Fri, Jul 31, 2026 at 10:58:41PM -0400, Tom Lane wrote:
> Ken Harris <kengruven@gmail.com> writes:
> > My message admittedly wandered a bit, but if I had to narrow it down to one
> > point of confusion for me, it'd be:
>
> > Why does shadowing the name of a built-in type behave differently, for
> > different built-in types?
>
> The short answer here is that some "built-in" types just have names
> that are in the pg_type catalog, while others have names that are
> recognized by the grammar and translated to pg_type names. For
> example, "double precision" is not a type name per the basic rules,
> but the SQL standard demands that we recognize it. So the grammar
> has a production that translates that to "pg_catalog.float8" ---
> not just float8 --- and that means that a user-defined type can't
> override the meaning of "double precision" no matter what the
> search path is. Another example is that "integer" is the name
> called out by the SQL spec for the type that is entered in
> pg_type as "int4". So "integer" is translated to "pg_catalog.int4"
> and you can't override that, but you could override plain "int4"
> depending on search_path. Conversely, some error messages translate
> type OIDs back to the SQL-standard names, but I suspect that not all
> do; there may be places that just report the pg_type name.
Should we prohibit users from creating types that are hard-coded into
the grammar?
--
Bruce Momjian <bruce@momjian.us> https://momjian.us
EDB https://enterprisedb.com
Do not let urgent matters crowd out time for investment in the future.
view thread (4+ messages)
Message-ID: <aodySMS-W9W0jFKv@momjian.us>
Permalink: ../aodySMS-W9W0jFKv@momjian.us/
Also on: postgresql.org/message-id/aodySMS-W9W0jFKv@momjian.us
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 using the --to and --cc options:
reply via email
To: pgsql-docs@postgresql.org
Cc: bruce@momjian.us, tgl@sss.pgh.pa.us, kengruven@gmail.com, david.g.johnston@gmail.com, pgsql-docs@lists.postgresql.org
Subject: Re: Shadowing type names because I am not smart
In-Reply-To: <aodySMS-W9W0jFKv@momjian.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox