8.2.2 regression with indices on user functions, 8.2.1 works - Mailing list pgsql-bugs

From Tomas Szepe
Subject 8.2.2 regression with indices on user functions, 8.2.1 works
Date
Msg-id 20070206091032.GG4631@louise.pinerecords.com
Whole thread Raw
Responses Re: 8.2.2 regression with indices on user functions, 8.2.1 works  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
Hi,

Upgraded to 8.2.2 last night and had to revert to 8.2.1
first thing in the morning after hitting this problem:

A trivial update like
    update mwdev set nick='Bezno-V-360';
fails with
    ERROR:  attribute 1 has wrong type
    DETAIL:  Table has type character varying, but query expects character varying.

There are no further messages in server.log.

A minimal testcase to replicate the problem follows:

$ createdb -E UNICODE testdb
CREATE DATABASE
$ (cat| psql testdb) << EOF
CREATE FUNCTION e_tolower(text) RETURNS text
    AS \$_\$select translate(\$1, 'Q', 'q');\$_\$
    LANGUAGE sql IMMUTABLE;
CREATE TABLE testtbl (foo character varying(16) NOT NULL);
COPY testtbl (foo) FROM stdin;
whatever
\.
CREATE UNIQUE INDEX testtbl_testidx ON testtbl
    USING btree (e_tolower((foo)::text));
UPDATE testtbl SET foo='whatever2';
EOF
CREATE FUNCTION
CREATE TABLE
CREATE INDEX
ERROR:  attribute 1 has wrong type
DETAIL:  Table has type character varying, but query expects character varying.
$

Just putting back the old 8.2.1 binaries is enough
(the problem disappears), no need to redump/reinitdb.

System: Linux 2.6.20, x86, glibc 2.5, gcc 4.1.1.

Hope this helps,
--
Tomas Szepe <szepe@pinerecords.com>

pgsql-bugs by date:

Previous
From: "Martin Pitt"
Date:
Subject: BUG #2971: 8.1.7/8.2.2 break constraint checking for 'update'
Next
From: "Ümit Öztosun"
Date:
Subject: Strange "Table has type character varying, but query expects character varying" errors