Bug #963: Weird plpython trigger(?) behaviour in 7.3.2

From: pgsql-bugs(at)postgresql(dot)org
To: pgsql-bugs(at)postgresql(dot)org
Subject: Bug #963: Weird plpython trigger(?) behaviour in 7.3.2
Date: 2003-05-02 16:13:52
Message-ID: 20030502161352.47634476380@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Indrek Jarve (incx(at)inversion(dot)ee) reports a bug with a severity of 3
The lower the number the more severe it is.

Short Description
Weird plpython trigger(?) behaviour in 7.3.2

Long Description
Hi,

using an plpython BEFORE INSERT FOR EACH ROW trigger that modifies the
inserted row on the schema attached below seems to cause weird side effects: when the trigger modifies field1 (in this case varchar(300)) contents to be longer than the size of field2 (in this case varchar(16)), the backend refuses to insert the row and replies: "ERROR: value too long for type character varying(16)", even when field2 is a shorter string and is NOT modified by the trigger. Removing the limit from field2 (for example declaring it as text) causes the error to disappear.

System: Redhat 9 with updates on a dual-p3, PostgreSQL 7.3.2 installed from RPM packages that came with it.

Regards,
Indrek

Sample Code
Used SQL:

CREATE TABLE items (
field1 character varying(300),
field2 varchar(16)
);

CREATE FUNCTION test_func () RETURNS "trigger"
AS '
# Set field1 LONGER than 16 chars
TD[''new''][''field1''] = ''aabaaaaaaaaaaaaaaa''
return ''MODIFY''
'
LANGUAGE plpython;

COPY items (field1, field2) FROM stdin;
asdf1 asdf2
\.

CREATE TRIGGER test_trig
BEFORE INSERT ON items
FOR EACH ROW
EXECUTE PROCEDURE test_func ();

insert into items ( field2 ) values ( '' );

psql result:

[incx(at)hercules incx]$ psql incx < bugine.txt
CREATE TABLE
CREATE FUNCTION
CREATE TRIGGER
ERROR: value too long for type character varying(16)

No file was uploaded with this report

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Josh Berkus 2003-05-02 18:08:22 Very bizarre bug with corrupted index
Previous Message A.Bhuvaneswaran 2003-05-02 09:07:55 Re: Bug #962: can't drop column