dbTalk Databases Forums  

[BUGS] User-defined type name begins with the underscore character (_) can be created

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] User-defined type name begins with the underscore character (_) can be created in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Pavel Golub
 
Posts: n/a

Default [BUGS] User-defined type name begins with the underscore character (_) can be created - 12-12-2006 , 02:52 AM






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 server treats it as 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

--
With best wishes,
Pavel mailtoavel (AT) microolap (DOT) com


---------------------------(end of broadcast)---------------------------
TIP 7: You can help support the PostgreSQL project by donating at

http://www.postgresql.org/about/donate

Reply With Quote
  #2  
Old   
Tom Lane
 
Posts: n/a

Default Re: [BUGS] User-defined type name begins with the underscore character (_) can be created - 12-12-2006 , 11:05 AM






Pavel Golub <pavel (AT) microolap (DOT) com> writes:
Quote:
Documentation says:
"User-defined type names cannot begin with the
underscore character (_)
We've never actually enforced that AFAIK, so this might be considered a
documentation bug.

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

CREATE TABLE my_table(
my_arr my[]
);
You could argue that the problem there is that LookupTypeName is not
verifying that what it finds is really an array of the specified type.
We could make it look up the given name without modification and then
apply get_array_type(), but this would mean two catalog lookups not one.
Still, that might be better than possibly breaking applications that
have historically worked.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.