In a plpython trigger, if you return "MODIFY", the parsing of the
TD["new"] dictionary uses the wrong (c array) index to locate the
atttypmod value, leading to subtle bugs dependent on the exact types,
names, and order of fields in the table in question.

(Types need to be those that use the typmod, names affect the ordering
in the python dictionary, and order affects the c array).

In my case, I ended up with TIMESTAMP(68), which was just slightly
more precision than I really wanted ;-)

Here's a patch that fixes my issue.  I have not extensively developed
tests for it.



diff -ur postgresql-7.3.2.orig/src/pl/plpython/plpython.c 
--- postgresql-7.3.2.orig/src/pl/plpython/plpython.c    Fri Jan 31 17:35:27 2003
+++ postgresql-7.3.2/src/pl/plpython/plpython.c Wed Feb 12 19:22:08 2003
@@ -630,7 +630,7 @@
                        modvalues[j] = 
                        modnulls[j] = ' ';


---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Reply via email to