Re: Current enums patch

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Heikki Linnakangas <heikki(at)enterprisedb(dot)com>, Tom Dunstan <pgsql(at)tomd(dot)cc>, pgsql-patches(at)postgresql(dot)org
Subject: Re: Current enums patch
Date: 2007-04-02 17:43:46
Message-ID: 461140D2.3070801@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Tom Lane wrote:
> Heikki Linnakangas <heikki(at)enterprisedb(dot)com> writes:
>
>> There's a little bug:
>>
>
>
>> postgres=# CREATE TYPE aenum AS ENUM ('a','b','c'); CREATE TYPE
>> postgres=# CREATE TABLE t (e aenum); CREATE TABLE postgres=# INSERT
>> INTO t VALUES
>> ('foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo');
>> server closed the connection unexpectedly
>>
>
> Hm, I suppose we should apply truncate_identifier rather than letting
> the strings be blindly truncated (perhaps in mid-character). Should we
> have it throw the truncation NOTICE, or not? First thought is to do so
> during CREATE TYPE but not during plain enum_in().
>

I don't see much point in truncating.

The patch I have so far gives the regression output shown below (yes, I
should make the messages more consistent).

In fact the truncation and associated NOTICE just strike me as confusing.

cheers

andrew

+ -- Name, Values too long
+ --
+ CREATE TYPE
+
abcdefghijklmnopqrsatuvwxyz0123456789abcdefghijklmnopqrsatuvwxyz0123456789
+ AS ENUM('a');
+ NOTICE: identifier
"abcdefghijklmnopqrsatuvwxyz0123456789abcdefghijklmnopqrsatuvwxyz0123456789"
will be truncated to
"abcdefghijklmnopqrsatuvwxyz0123456789abcdefghijklmnopqrsatuvwxy"
+ ERROR: type names must be 62 characters or less
+ CREATE TYPE toolong AS ENUM
+
('abcdefghijklmnopqrsatuvwxyz0123456789abcdefghijklmnopqrsatuvwxyz0123456789');
+ ERROR: invalid enum label
"abcdefghijklmnopqrsatuvwxyz0123456789abcdefghijklmnopqrsatuvwxyz0123456789":
must be 63 characters or less
+ INSERT INTO enumtest VALUES
+
('abcdefghijklmnopqrsatuvwxyz0123456789abcdefghijklmnopqrsatuvwxyz0123456789');
+ ERROR: input value too long (74) for enum:
"abcdefghijklmnopqrsatuvwxyz0123456789abcdefghijklmnopqrsatuvwxyz0123456789"
+ --

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Simon Riggs 2007-04-02 17:45:22 Re: [COMMITTERS] pgsql: Add GUC temp_tablespaces toprovide a default location for
Previous Message Bruce Momjian 2007-04-02 17:09:29 Re: Blocked post