Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 3DFCE1337B8C for ; Sat, 4 Dec 2010 20:25:28 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 02403-02 for ; Sun, 5 Dec 2010 00:25:28 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from wwwmaster.postgresql.org (wwwmaster.postgresql.org [217.196.146.204]) by mail.postgresql.org (Postfix) with ESMTP id 3AF321337B77 for ; Sat, 4 Dec 2010 20:25:27 -0400 (AST) Received: from wwwmaster.postgresql.org (wwwmaster.postgresql.org [217.196.146.204]) by wwwmaster.postgresql.org (8.14.3/8.14.3) with ESMTP id oB50PRjr076626 for ; Sun, 5 Dec 2010 00:25:27 GMT (envelope-from www@wwwmaster.postgresql.org) Received: (from www@localhost) by wwwmaster.postgresql.org (8.14.3/8.14.3/Submit) id oB50PRwx076625; Sun, 5 Dec 2010 00:25:27 GMT (envelope-from www) Date: Sun, 5 Dec 2010 00:25:27 GMT Message-Id: <201012050025.oB50PRwx076625@wwwmaster.postgresql.org> To: pgsql-bugs@postgresql.org Subject: BUG #5783: plpythonu bool behavior change From: "Adrian Klaver" Content-Type: text/plain; charset=utf-8 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 201012/32 X-Sequence-Number: 28838 The following bug has been logged online: Bug reference: 5783 Logged by: Adrian Klaver Email address: adrian.klaver@gmail.com PostgreSQL version: 9.0.1 Operating system: Linux Ubuntu 10.04 Description: plpythonu bool behavior change Details: Seems there was a change in behavior for plpythonu with regards to boolean fields from 8.4 to 9.0. Previously, setting a field inside a plpythonu function to "f" would work, now that returns a 't' in the database field. To get the 'f' to appear I have to specify False inside the function. The only thing I can find in recent commits that would apply is: http://git.postgresql.org/gitweb?p=postgresql.git;a=commit;h=09130e5867d49c7 2ef0f11bef30c5385d83bf194 Below is test case that illustrates what I am seeing in 9.0.1: DROP TABLE IF EXISTS plpython_type; CREATE TABLE plpython_type (id integer, txt_fld text, bool_fld boolean ); DROP FUNCTION IF EXISTS plpython_test(); CREATE OR REPLACE FUNCTION plpython_test() RETURNS trigger AS $Body$ TD["new"]["bool_fld"] = "f" return "MODIFY" $Body$ LANGUAGE plpythonu; CREATE TRIGGER plpython_trg BEFORE INSERT ON plpython_type FOR EACH ROW EXECUTE PROCEDURE plpython_test(); INSERT INTO plpython_type VALUES (1,'test'); CREATE OR REPLACE FUNCTION plpython_test() RETURNS trigger AS $Body$ TD["new"]["bool_fld"] = False return "MODIFY" $Body$ LANGUAGE plpythonu; INSERT INTO plpython_type VALUES (2,'test'); SELECT * FROM plpython_type; Result: id | txt_fld | bool_fld ----+---------+---------- 1 | test | t 2 | test | f (2 rows)