Re: plpython test change...

Started by Bruce Momjianover 23 years ago1 messagespatches
Jump to latest
#1Bruce Momjian
bruce@momjian.us

Your patch has been added to the PostgreSQL unapplied patches list at:

http://momjian.postgresql.org/cgi-bin/pgpatches

I will try to apply it within the next 48 hours.

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

Mike Meyer wrote:

It may not be obvious to you, but the plpython regression tests
include output that vary depending on the python build one is
running. Basically, the order of keys in a dictionary is
non-deterministic, and that part of the test fails for me regularly.

I rewrote the test to work around this problem, and include a patch
file with that change and the change to the expected otuput as well.

Thanks,
<mike

diff -ru /datmp/ports/usr/ports/databases/postgresql7/work/postgresql-7.3.2/src/pl/plpython/feature.expected ./feature.expected
--- /datmp/ports/usr/ports/databases/postgresql7/work/postgresql-7.3.2/src/pl/plpython/feature.expected	Sun Oct 13 23:20:52 2002
+++ ./feature.expected	Tue Mar 25 12:18:28 2003
@@ -54,11 +54,11 @@
(1 row)
select argument_test_one(users, fname, lname) from users where lname = 'doe' order by 1;
-                                  argument_test_one                                  
--------------------------------------------------------------------------------------
- jane doe => {'fname': 'jane', 'userid': 1, 'lname': 'doe', 'username': 'j_doe'}
- john doe => {'fname': 'john', 'userid': 2, 'lname': 'doe', 'username': 'johnd'}
- willem doe => {'fname': 'willem', 'userid': 3, 'lname': 'doe', 'username': 'w_doe'}
+                           argument_test_one                           
+-----------------------------------------------------------------------
+ jane doe => {fname: jane, lname: doe, userid: 1, username: j_doe}
+ john doe => {fname: john, lname: doe, userid: 2, username: johnd}
+ willem doe => {fname: willem, lname: doe, userid: 3, username: w_doe}
(3 rows)
select nested_call_one('pass this along');
diff -ru /datmp/ports/usr/ports/databases/postgresql7/work/postgresql-7.3.2/src/pl/plpython/plpython_function.sql ./plpython_function.sql
--- /datmp/ports/usr/ports/databases/postgresql7/work/postgresql-7.3.2/src/pl/plpython/plpython_function.sql	Wed Aug 21 19:01:50 2002
+++ ./plpython_function.sql	Tue Mar 25 12:15:25 2003
@@ -82,7 +82,12 @@
CREATE FUNCTION argument_test_one(users, text, text) RETURNS text
AS
-'words = args[1] + " " + args[2] + " => " + str(args[0])
+'keys = args[0].keys()
+keys.sort()
+out = []
+for key in keys:
+    out.append("%s: %s" % (key, args[0][key]))
+words = args[1] + " " + args[2] + " => {" + ", ".join(out) + "}"
return words'
LANGUAGE 'plpython';

guru%
--
Mike Meyer <mwm@mired.org> http://www.mired.org/consulting.html
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073