diff --git a/postgresql-odbc-09.05.0210-revert-money-fix.patch b/postgresql-odbc-09.05.0210-revert-money-fix.patch new file mode 100644 index 0000000..fa2b4f5 --- /dev/null +++ b/postgresql-odbc-09.05.0210-revert-money-fix.patch @@ -0,0 +1,96 @@ +From fb2a42483d318186079469576ce5991437d7a635 Mon Sep 17 00:00:00 2001 +From: Pavel Raiskup +Date: Mon, 18 Apr 2016 14:55:16 +0200 +Subject: [PATCH] Revert "Fix the bug about MONEY type." + +This reverts commit d5374bcc4d58556eb5cc70241c44dcad4d9b441e. + +Proposed upstream: +http://www.postgresql.org/message-id/3259874.lgiBp3an9Y@nb.usersys.redhat.com +--- + convert.c | 45 ++++++++------------------------------------- + pgtypes.c | 5 +++++ + 2 files changed, 13 insertions(+), 37 deletions(-) + +diff --git a/convert.c b/convert.c +index 830910a..f9eba76 100644 +--- a/convert.c ++++ b/convert.c +@@ -5255,50 +5255,21 @@ cleanup: + static BOOL + convert_money(const char *s, char *sout, size_t soutmax) + { +- char in, decp = 0; + size_t i = 0, + out = 0; +- int num_in = -1, period_in = -1, comma_in = -1; + + for (i = 0; s[i]; i++) + { +- switch (in = s[i]) ++ if (s[i] == '$' || s[i] == ',' || s[i] == ')') ++ ; /* skip these characters */ ++ else + { +- case '.': +- if (period_in < 0) +- period_in = i; +- break; +- case ',': +- if (comma_in < 0) +- comma_in = i; +- break; +- default: +- if ('0' <= in && '9' >= in) +- num_in = i; +- break; +- } +- } +- if (period_in > comma_in) +- { +- if ( period_in >= num_in - 2) +- decp = '.'; +- } +- else if (comma_in >= 0 && +- comma_in >= num_in - 2) +- decp = ','; +- for (i = 0; s[i] && out + 1 < soutmax; i++) +- { +- switch (in = s[i]) +- { +- case '(': +- case '-': ++ if (out + 1 >= soutmax) ++ return FALSE; /* sout is too short */ ++ if (s[i] == '(') + sout[out++] = '-'; +- break; +- default: +- if (in >= '0' && in <= '9') +- sout[out++] = in; +- else if (in == decp) +- sout[out++] = '.'; ++ else ++ sout[out++] = s[i]; + } + } + sout[out] = '\0'; +diff --git a/pgtypes.c b/pgtypes.c +index d15b097..649a2f8 100644 +--- a/pgtypes.c ++++ b/pgtypes.c +@@ -1282,6 +1282,11 @@ sqltype_to_bind_pgtype(const ConnectionClass *conn, SQLSMALLINT fSqlType) + pgType = PG_TYPE_DATE; + break; + ++ case SQL_DOUBLE: ++ case SQL_FLOAT: ++ pgType = PG_TYPE_FLOAT8; ++ break; ++ + case SQL_DECIMAL: + case SQL_NUMERIC: + pgType = PG_TYPE_NUMERIC; +-- +2.5.5 + diff --git a/postgresql-odbc-09.05.0400-revert-money-testsuite-fix.patch b/postgresql-odbc-09.05.0400-revert-money-testsuite-fix.patch new file mode 100644 index 0000000..0a115ca --- /dev/null +++ b/postgresql-odbc-09.05.0400-revert-money-testsuite-fix.patch @@ -0,0 +1,49 @@ +Revert "Fix regression test failures in param-convesrions-test." + +As we have applied a downstream patch for reverting the money type patch, +we need to also revert upstream test cases that are not supposed to be passing +in the first place. +This reverts commit eb480e19ee71b19de7f61013bdb4d5abd1cd98e4. + +Related discussion: +http://www.postgresql.org/message-id/3259874.lgiBp3an9Y@nb.usersys.redhat.com +--- + +diff --git a/test/expected/param-conversions.out b/test/expected/param-conversions.out +index 449a398..777cc94 100644 +--- a/test/expected/param-conversions.out ++++ b/test/expected/param-conversions.out +@@ -72,12 +72,12 @@ Error while executing the query + + Testing "SELECT 1.3 > ?" with SQL_C_CHAR -> SQL_FLOAT param "3', 'injected, BAD!', '1"... + SQLExecDirect failed ++22P02=ERROR: invalid input syntax for type double precision: "3', 'injected, BAD!', '1"; +-22P02=ERROR: invalid input syntax for type numeric: "3', 'injected, BAD!', '1"; + Error while executing the query + + Testing "SELECT 1.4 > ?" with SQL_C_CHAR -> SQL_FLOAT param "4 \'bad', '1"... + SQLExecDirect failed ++22P02=ERROR: invalid input syntax for type double precision: "4 \'bad', '1"; +-22P02=ERROR: invalid input syntax for type numeric: "4 \'bad', '1"; + Error while executing the query + + Testing "SELECT 1-?" with SQL_C_CHAR -> SQL_INTEGER param "-1"... +diff --git a/test/expected/param-conversions_1.out b/test/expected/param-conversions_1.out +index 8c8e003..20f97b5 100644 +--- a/test/expected/param-conversions_1.out ++++ b/test/expected/param-conversions_1.out +@@ -71,12 +71,12 @@ Error while executing the query + + Testing "SELECT 1.3 > ?" with SQL_C_CHAR -> SQL_FLOAT param "3', 'injected, BAD!', '1"... + SQLExecDirect failed ++22P02=ERROR: invalid input syntax for type double precision: "3', 'injected, BAD!', '1"; +-22P02=ERROR: invalid input syntax for type numeric "3', 'injected, BAD!', '1"; + Error while executing the query + + Testing "SELECT 1.4 > ?" with SQL_C_CHAR -> SQL_FLOAT param "4 \'bad', '1"... + SQLExecDirect failed ++22P02=ERROR: invalid input syntax for type double precision: "4 \'bad', '1"; +-22P02=ERROR: invalid input syntax for type numeric: "4 \'bad', '1"; + Error while executing the query + + Testing "SELECT 1-?" with SQL_C_CHAR -> SQL_INTEGER param "-1"... diff --git a/postgresql-odbc.spec b/postgresql-odbc.spec index 82c35b2..dbccd73 100644 --- a/postgresql-odbc.spec +++ b/postgresql-odbc.spec @@ -1,7 +1,7 @@ Name: postgresql-odbc Summary: PostgreSQL ODBC driver Version: 09.05.0400 -Release: 1%{?dist} +Release: 2%{?dist} License: LGPLv2+ Group: Applications/Databases URL: http://psqlodbc.projects.postgresql.org/ @@ -10,6 +10,8 @@ Source0: http://ftp.postgresql.org/pub/odbc/versions/src/psqlodbc-%{version}.tar Source1: postgres-testing.sh +Patch0: postgresql-odbc-09.05.0210-revert-money-fix.patch +Patch1: postgresql-odbc-09.05.0400-revert-money-testsuite-fix.patch BuildRequires: unixODBC-devel postgresql-devel BuildRequires: postgresql-server @@ -97,6 +99,10 @@ the PostgreSQL unixODBC driver. %changelog +* Mon Aug 29 2016 Petr Kubat - 09.05.0400-2 +- once again revert upstream commit d5374bcc4d +- also revert its accompanying testsuite commit eb480e19ee + * Thu Aug 11 2016 Petr Kubat - 09.05.0400-1 - rebase to latest upstream version, per release notes: https://odbc.postgresql.org/docs/release.html