Skip site navigation (1) Skip section navigation (2)

PL/Python problem

From: "Klimt,Bryan" <bryan(dot)klimt(at)dhs(dot)state(dot)tx(dot)us>
To: pgsql-interfaces(at)postgresql(dot)org
Subject: PL/Python problem
Date: 2003-02-10 20:09:23
Message-ID: (view raw, whole thread or download thread mbox)
Lists: 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';

  BEFORE INSERT ON mdsqiitems1
      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)".

  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

Next:From: Frankie LamDate: 2003-02-11 03:53:39
Subject: Any timeout feature(in libPQ) suitable for my case?
Previous:From: Jeroen T. VermeulenDate: 2003-02-10 20:05:22
Subject: libpqxx presentation

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group