Unix Technical Forum

create type error message

This is a discussion on create type error message within the pgsql Hackers forums, part of the PostgreSQL category; --> # select version(); version -------------------------------------------------------------------------------------------- PostgreSQL 8.1.3 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.3.5 (Debian 1:3.3.5-13) (1 row) ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Hackers

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-12-2008, 01:41 AM
Jim Buttafuoco
 
Posts: n/a
Default create type error message


# select version();
version
--------------------------------------------------------------------------------------------
PostgreSQL 8.1.3 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.3.5 (Debian 1:3.3.5-13)
(1 row)

simple example:
# create type a as (a text,b int);
CREATE TYPE
# create type a as (a text,b int);
ERROR: relation "a" already exists

seems like

ERROR: type "a" already exists
would be better.

Thanks
Jim


---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-12-2008, 01:41 AM
Tom Lane
 
Posts: n/a
Default Re: create type error message

"Jim Buttafuoco" <jim@contactbda.com> writes:
> # create type a as (a text,b int);
> CREATE TYPE
> # create type a as (a text,b int);
> ERROR: relation "a" already exists


> seems like
> ERROR: type "a" already exists
> would be better.


It's not really all that easy, because tables and composite types both
have entries in both pg_class and pg_type. Consider

regression=# create table tt (a text,b int);
CREATE TABLE
regression=# create type tt as (a text,b int);
ERROR: relation "tt" already exists

regression=# create type zz as (a text,b int);
CREATE TYPE
regression=# create table zz (a text,b int);
ERROR: relation "zz" already exists

In all three cases the error is actually detected inside
heap_create_with_catalog, because we choose to make the pg_class entry
first. We could possibly alter the error report based on the relkind
of the entry we are about to make, but I'm unconvinced it'd be an
improvement...

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
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
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 02:55 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com