BUG #4747: Some type names accepted in place of column name.

From: "Bruce Toll" <btoll(at)dhsus(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #4747: Some type names accepted in place of column name.
Date: 2009-04-01 18:55:42
Message-ID: 200904011855.n31ItgjU047609@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 4747
Logged by: Bruce Toll
Email address: btoll(at)dhsus(dot)com
PostgreSQL version: 8.4devel
Operating system: GNU/Linux (Ubuntu Hardy)
Description: Some type names accepted in place of column name.
Details:

Hello,

In 8.4devel postgres, it appears that some type names
are accepted in place of column names, e.g "name".
This is different behavior than in 8.3.

For instance, the pg_catalog.pg_class table has no
column "name", yet the following query returns rows from the pg_class
table:

8.4devel (no contrib modules installed):
==================================================================
SELECT pg_class.name FROM pg_class limit 2;

name
-----------------------------------------------------------------
(pg_type,11,71,10,0,1247,0,62,676,0,0,t,f,r,28,0,t,f,f,f,f,648,
(pg_attribute,11,75,10,0,1249,0,587,6145,0,0,t,f,r,18,0,f,f,f,f
(2 rows)
==================================================================

8.3.6:
==================================================================
SELECT pg_class.name FROM pg_class limit 2;

ERROR: column pg_class.name does not exist
LINE 1: SELECT pg_class.name FROM pg_class limit 2;
^
==================================================================

The change in behavior appears to be related to this changeset:
==================================================================
Date: Wed Jul 30 21:23:17 2008 +0000

Allow I/O conversion casts to be applied to or from any type that is a
member
of the STRING type category, thereby opening up the mechanism for
user-defined
types. This is mainly for the benefit of citext, though; there aren't
likely
to be a lot of types that are all general-purpose character strings.
[commit message truncated]
==================================================================

The 8.4devel output of 'select version();'
----------------------------------------------------------------------------
--
PostgreSQL 8.4devel on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 4.2.4
(Ubuntu 4.2.4-1ubuntu3), 32-bit

The tests were run on:
GNU/Linux (Ubuntu Hardy), 32bit Intel Core 2 Duo CPU,
Linux kernel 2.6.24-23-generic.

For reference, the last commit included in the 8.4devel build was:
----------------------------------------------------------
Author: Heikki Linnakangas <heikki(at)enterprisedb(dot)com>
Date: Wed Apr 1 09:17:32 2009 +0000

Update comment to reflect that LC_COLLATE and LC_CTYPE are now
per-database settings.
----------------------------------------------------------

Regards,
Bruce Toll

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2009-04-01 19:34:27 Re: BUG #4747: Some type names accepted in place of column name.
Previous Message Tom Lane 2009-04-01 13:39:01 Re: shared_buffers/SHMMAX defaults?