Change plpython_do test a bit so it is universal for all python versions

This commit is contained in:
Honza Horak 2014-05-23 16:53:07 +02:00
parent b57df46f2d
commit 832a5a0ffd
2 changed files with 40 additions and 1 deletions

34
postgresql-python34.patch Normal file
View File

@ -0,0 +1,34 @@
The error message for undefined names *inside functions* (not for undefined
names on global level) has changed in Python 3.4 compared to 3.3.
Particularly error string "NameError: global name 'nonsense' is not defined"
has become "ERROR: NameError: name 'nonsense' is not defined" in Python 3.4.
This patch also raises an exception, but the exceptin message is the same
across Python versions.
diff -up postgresql-9.3.4/src/pl/plpython/expected/plpython_do.out.python34 postgresql-9.3.4/src/pl/plpython/expected/plpython_do.out
--- postgresql-9.3.4/src/pl/plpython/expected/plpython_do.out.python34 2014-05-23 15:42:50.462783074 +0200
+++ postgresql-9.3.4/src/pl/plpython/expected/plpython_do.out 2014-05-23 16:09:28.501654085 +0200
@@ -4,9 +4,9 @@ CONTEXT: PL/Python anonymous code block
DO $$ plpy.notice("This is plpython2u.") $$ LANGUAGE plpython2u;
NOTICE: This is plpython2u.
CONTEXT: PL/Python anonymous code block
-DO $$ nonsense $$ LANGUAGE plpythonu;
-ERROR: NameError: global name 'nonsense' is not defined
+DO $$ raise Exception("Sample error") $$ LANGUAGE plpythonu;
+ERROR: Exception: Sample error
CONTEXT: Traceback (most recent call last):
PL/Python anonymous code block, line 1, in <module>
- nonsense
+ raise Exception("Sample error")
PL/Python anonymous code block
diff -up postgresql-9.3.4/src/pl/plpython/sql/plpython_do.sql.python34 postgresql-9.3.4/src/pl/plpython/sql/plpython_do.sql
--- postgresql-9.3.4/src/pl/plpython/sql/plpython_do.sql.python34 2014-05-23 15:42:24.240756276 +0200
+++ postgresql-9.3.4/src/pl/plpython/sql/plpython_do.sql 2014-05-23 16:10:31.363475875 +0200
@@ -2,4 +2,4 @@ DO $$ plpy.notice("This is plpythonu.")
DO $$ plpy.notice("This is plpython2u.") $$ LANGUAGE plpython2u;
-DO $$ nonsense $$ LANGUAGE plpythonu;
+DO $$ raise Exception("Sample error") $$ LANGUAGE plpythonu;

View File

@ -64,7 +64,7 @@ Summary: PostgreSQL client programs
Name: postgresql
%global majorversion 9.3
Version: 9.3.4
Release: 3%{?dist}
Release: 4%{?dist}
# The PostgreSQL license is very similar to other MIT licenses, but the OSI
# recognizes it as an independent license, so we do as well.
@ -108,6 +108,7 @@ Patch3: postgresql-perl-rpath.patch
Patch4: postgresql-config-comment.patch
Patch5: postgresql-var-run-socket.patch
Patch6: postgresql-man.patch
Patch7: postgresql-python34.patch
BuildRequires: perl(ExtUtils::MakeMaker) glibc-devel bison flex gawk help2man
BuildRequires: perl(ExtUtils::Embed), perl-devel
@ -335,6 +336,7 @@ benchmarks.
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
# We used to run autoconf here, but there's no longer any real need to,
# since Postgres ships with a reasonably modern configure script.
@ -1131,6 +1133,9 @@ fi
%endif
%changelog
* Fri May 23 2014 Honza Horak <hhorak@redhat.com> - 9.3.4-4
- Change plpython_do test a bit so it is universal for all python versions
* Wed May 21 2014 Jaroslav Škarvada <jskarvad@redhat.com> - 9.3.4-3
- Rebuilt for https://fedoraproject.org/wiki/Changes/f21tcl86