BUG #2852: User-defined type name begins with the underscore character (_) can be created

Lists: pgsql-bugs
From: "Pavel Golub" <pavel(at)microolap(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #2852: User-defined type name begins with the underscore character (_) can be created
Date: 2006-12-21 12:55:16
Message-ID: 200612211255.kBLCtGDh006359@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 2852
Logged by: Pavel Golub
Email address: pavel(at)microolap(dot)com
PostgreSQL version: 8.x
Operating system: Windows XP
Description: User-defined type name begins with the underscore
character (_) can be created
Details:

Hello, pgsql-bugs.

Documentation says:
"User-defined type names cannot begin with the
underscore character (_) and can only be 62
characters long (or in general NAMEDATALEN - 2,
rather than the NAMEDATALEN - 1 characters
allowed for other names). Type names beginning
with underscore are reserved for
internally-created array type names. "

However, such SQL may be executed:

CREATE TYPE _my AS (id int4, id2 int4);

And then server treats it as an array type. Thus next SQL will be executed
too:

CREATE TABLE my_table(
my_arr my[]
);

Checked on PostgreSQL versions (Windows XP):
8.0.6
8.1.0
8.2.0


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Pavel Golub <pavel(at)microolap(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #2852: User-defined type name begins with the
Date: 2006-12-23 01:28:31
Message-ID: 200612230128.kBN1SVr22412@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs


I have applied the following documentaiton patch that states a leading
underscore "shouldn't" be used, rather than prohibited.

---------------------------------------------------------------------------

Pavel Golub wrote:
>
> The following bug has been logged online:
>
> Bug reference: 2852
> Logged by: Pavel Golub
> Email address: pavel(at)microolap(dot)com
> PostgreSQL version: 8.x
> Operating system: Windows XP
> Description: User-defined type name begins with the underscore
> character (_) can be created
> Details:
>
> Hello, pgsql-bugs.
>
> Documentation says:
> "User-defined type names cannot begin with the
> underscore character (_) and can only be 62
> characters long (or in general NAMEDATALEN - 2,
> rather than the NAMEDATALEN - 1 characters
> allowed for other names). Type names beginning
> with underscore are reserved for
> internally-created array type names. "
>
> However, such SQL may be executed:
>
> CREATE TYPE _my AS (id int4, id2 int4);
>
> And then server treats it as an array type. Thus next SQL will be executed
> too:
>
> CREATE TABLE my_table(
> my_arr my[]
> );
>
> Checked on PostgreSQL versions (Windows XP):
> 8.0.6
> 8.1.0
> 8.2.0
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Have you searched our list archives?
>
> http://archives.postgresql.org

--
Bruce Momjian bruce(at)momjian(dot)us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

Attachment Content-Type Size
/rtmp/diff text/x-diff 1.2 KB

From: Pavel Golub <pavel(at)microolap(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Subject: Re: BUG #2852: User-defined type name begins with the
Date: 2006-12-25 07:50:43
Message-ID: 1691397034.20061225095043@microolap.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Hello, Bruce.

Thanks for an answer. Are there any thoughts to insert check into
PostgreSQL code or we (developers) must take into account that UDT
with leading underscore may exist?

You wrote:

BM> I have applied the following documentaiton patch that states a leading
BM> underscore "shouldn't" be used, rather than prohibited.

BM> ---------------------------------------------------------------------------

BM> Pavel Golub wrote:
>>
>> The following bug has been logged online:
>>
>> Bug reference: 2852
>> Logged by: Pavel Golub
>> Email address: pavel(at)microolap(dot)com
>> PostgreSQL version: 8.x
>> Operating system: Windows XP
>> Description: User-defined type name begins with the underscore
>> character (_) can be created
>> Details:
>>
>> Hello, pgsql-bugs.
>>
>> Documentation says:
>> "User-defined type names cannot begin with the
>> underscore character (_) and can only be 62
>> characters long (or in general NAMEDATALEN - 2,
>> rather than the NAMEDATALEN - 1 characters
>> allowed for other names). Type names beginning
>> with underscore are reserved for
>> internally-created array type names. "
>>
>> However, such SQL may be executed:
>>
>> CREATE TYPE _my AS (id int4, id2 int4);
>>
>> And then server treats it as an array type. Thus next SQL will be executed
>> too:
>>
>> CREATE TABLE my_table(
>> my_arr my[]
>> );
>>
>> Checked on PostgreSQL versions (Windows XP):
>> 8.0.6
>> 8.1.0
>> 8.2.0
>>
>> ---------------------------(end of broadcast)---------------------------
>> TIP 4: Have you searched our list archives?
>>
>> http://archives.postgresql.org

--
With best wishes,
Pavel mailto:pavel(at)microolap(dot)com