Tom Lane wrote:
Heikki Linnakangas <[EMAIL PROTECTED]> 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"
+ --
---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings