PL/Python problem - Mailing list pgsql-interfaces

From Klimt,Bryan
Subject PL/Python problem
Date
Msg-id C98621D17B337E4284E03A4BAA76F6A505F82FB9@ausmis09.dhs.state.tx.us
Whole thread Raw
List pgsql-interfaces
I am using the latest cygwin build of postgresql and python
I used this code to create a trigger:

---------------------------------------------------------------

CREATE FUNCTION negaterow() RETURNS trigger AS
'if TD["new"]["a3a"]!=None and TD["new"]["assmt_in_id"]!=None: TD["new"]["nega3a"] = 0-TD["new"]["a3a"]
TD["new"]["negassmt_in_id"]= 0-TD["new"]["assmt_in_id"] return "MODIFY"
 
return None'
LANGUAGE 'plpython';

CREATE TRIGGER negate BEFORE INSERT ON mdsqiitems1   FOR EACH ROW     EXECUTE PROCEDURE negaterow();

---------------------------------------------------------------

Whenever I insert a row: If no string in the data is longer that length 1, it works fine. If a string is longer, it
says  "ERROR:  value too long for type character varying(1)".
 

But: a)  The fields in question are _not_ varchar(1). b)  It works fine without the trigger.

What's going on?

-Bryan Klimt



pgsql-interfaces by date:

Previous
From: Aidamir Lovpache
Date:
Subject: Using socket operations in strored SPI procedures. What cause it?
Next
From: Hans-Jürgen Schönig
Date:
Subject: DBI transaction handling ...