Upstream patch to add support for PostgreSQL 12 (#1815921)
Signed-off-by: Robert-André Mauchin <zebob.m@gmail.com>
This commit is contained in:
parent
52cb5cfa20
commit
048d2137d8
|
@ -0,0 +1,98 @@
|
|||
From 14b61d48e8bad6223a08843cf363ef48f09c479b Mon Sep 17 00:00:00 2001
|
||||
From: Christian Ehrlicher <ch.ehrlicher@gmx.de>
|
||||
Date: Fri, 11 Oct 2019 20:53:49 +0200
|
||||
Subject: QPSQL: Add support for PostgreSQL 12
|
||||
|
||||
Add proper version check and replace long deprecated and now removed
|
||||
access to pg_attrdef.adsrc.
|
||||
|
||||
[ChangeLog][QtSql][QPSQL] added support for PostgreSQL 12
|
||||
|
||||
Fixes: QTBUG-79033
|
||||
Fixes: QTBUG-79064
|
||||
Change-Id: Iec1b13945c34ea017139ad1c5539ab5b7f1e03aa
|
||||
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
|
||||
---
|
||||
src/plugins/sqldrivers/psql/qsql_psql.cpp | 43 +++++++++++++++++--------------
|
||||
src/plugins/sqldrivers/psql/qsql_psql_p.h | 1 +
|
||||
2 files changed, 25 insertions(+), 19 deletions(-)
|
||||
|
||||
diff --git a/src/plugins/sqldrivers/psql/qsql_psql.cpp b/src/plugins/sqldrivers/psql/qsql_psql.cpp
|
||||
index 3803f05b9f..760685f64b 100644
|
||||
--- a/src/plugins/sqldrivers/psql/qsql_psql.cpp
|
||||
+++ b/src/plugins/sqldrivers/psql/qsql_psql.cpp
|
||||
@@ -1078,8 +1078,10 @@ static QPSQLDriver::Protocol qMakePSQLVersion(int vMaj, int vMin)
|
||||
return QPSQLDriver::Version10;
|
||||
case 11:
|
||||
return QPSQLDriver::Version11;
|
||||
+ case 12:
|
||||
+ return QPSQLDriver::Version12;
|
||||
default:
|
||||
- if (vMaj > 11)
|
||||
+ if (vMaj > 12)
|
||||
return QPSQLDriver::UnknownLaterVersion;
|
||||
break;
|
||||
}
|
||||
@@ -1439,26 +1441,29 @@ QSqlRecord QPSQLDriver::record(const QString &tablename) const
|
||||
schema = stripDelimiters(schema, QSqlDriver::TableName);
|
||||
tbl = stripDelimiters(tbl, QSqlDriver::TableName);
|
||||
|
||||
- QString stmt = QStringLiteral("SELECT pg_attribute.attname, pg_attribute.atttypid::int, "
|
||||
- "pg_attribute.attnotnull, pg_attribute.attlen, pg_attribute.atttypmod, "
|
||||
- "pg_attrdef.adsrc "
|
||||
- "FROM pg_class, pg_attribute "
|
||||
- "LEFT JOIN pg_attrdef ON (pg_attrdef.adrelid = "
|
||||
- "pg_attribute.attrelid AND pg_attrdef.adnum = pg_attribute.attnum) "
|
||||
- "WHERE %1 "
|
||||
- "AND pg_class.relname = '%2' "
|
||||
- "AND pg_attribute.attnum > 0 "
|
||||
- "AND pg_attribute.attrelid = pg_class.oid "
|
||||
- "AND pg_attribute.attisdropped = false "
|
||||
- "ORDER BY pg_attribute.attnum");
|
||||
- if (schema.isEmpty())
|
||||
- stmt = stmt.arg(QStringLiteral("pg_table_is_visible(pg_class.oid)"));
|
||||
- else
|
||||
- stmt = stmt.arg(QStringLiteral("pg_class.relnamespace = (SELECT oid FROM "
|
||||
- "pg_namespace WHERE pg_namespace.nspname = '%1')").arg(schema));
|
||||
+ const QString adsrc = protocol() < Version8
|
||||
+ ? QStringLiteral("pg_attrdef.adsrc")
|
||||
+ : QStringLiteral("pg_get_expr(pg_attrdef.adbin, pg_attrdef.adrelid)");
|
||||
+ const QString nspname = schema.isEmpty()
|
||||
+ ? QStringLiteral("pg_table_is_visible(pg_class.oid)")
|
||||
+ : QStringLiteral("pg_class.relnamespace = (SELECT oid FROM "
|
||||
+ "pg_namespace WHERE pg_namespace.nspname = '%1')").arg(schema);
|
||||
+ const QString stmt =
|
||||
+ QStringLiteral("SELECT pg_attribute.attname, pg_attribute.atttypid::int, "
|
||||
+ "pg_attribute.attnotnull, pg_attribute.attlen, pg_attribute.atttypmod, "
|
||||
+ "%1 "
|
||||
+ "FROM pg_class, pg_attribute "
|
||||
+ "LEFT JOIN pg_attrdef ON (pg_attrdef.adrelid = "
|
||||
+ "pg_attribute.attrelid AND pg_attrdef.adnum = pg_attribute.attnum) "
|
||||
+ "WHERE %2 "
|
||||
+ "AND pg_class.relname = '%3' "
|
||||
+ "AND pg_attribute.attnum > 0 "
|
||||
+ "AND pg_attribute.attrelid = pg_class.oid "
|
||||
+ "AND pg_attribute.attisdropped = false "
|
||||
+ "ORDER BY pg_attribute.attnum").arg(adsrc, nspname, tbl);
|
||||
|
||||
QSqlQuery query(createResult());
|
||||
- query.exec(stmt.arg(tbl));
|
||||
+ query.exec(stmt);
|
||||
while (query.next()) {
|
||||
int len = query.value(3).toInt();
|
||||
int precision = query.value(4).toInt();
|
||||
diff --git a/src/plugins/sqldrivers/psql/qsql_psql_p.h b/src/plugins/sqldrivers/psql/qsql_psql_p.h
|
||||
index 99e0b5f60f..9ac1fb50d7 100644
|
||||
--- a/src/plugins/sqldrivers/psql/qsql_psql_p.h
|
||||
+++ b/src/plugins/sqldrivers/psql/qsql_psql_p.h
|
||||
@@ -93,6 +93,7 @@ public:
|
||||
Version9_6 = 22,
|
||||
Version10 = 23,
|
||||
Version11 = 24,
|
||||
+ Version12 = 25,
|
||||
UnknownLaterVersion = 100000
|
||||
};
|
||||
|
||||
--
|
||||
cgit v1.2.1
|
||||
|
|
@ -53,7 +53,7 @@ BuildRequires: pkgconfig(libsystemd)
|
|||
Name: qt5-qtbase
|
||||
Summary: Qt5 - QtBase components
|
||||
Version: 5.13.2
|
||||
Release: 3%{?dist}
|
||||
Release: 4%{?dist}
|
||||
|
||||
# See LGPL_EXCEPTIONS.txt, for exception details
|
||||
License: LGPLv2 with exceptions or GPLv3 with exceptions
|
||||
|
@ -135,6 +135,8 @@ Patch80: qtbase-use-wayland-on-gnome.patch
|
|||
## upstream patches
|
||||
Patch100: 0001-Do-not-load-plugin-from-the-PWD.patch
|
||||
Patch101: 0001-QLibrary-Unix-do-not-attempt-to-load-a-library-relat.patch
|
||||
# Add support for PostgreSQL 12
|
||||
Patch102: https://code.qt.io/cgit/qt/qtbase.git/patch/?id=14b61d48#/0001-QPSQL-Add-support-for-PostgreSQL-12.patch
|
||||
|
||||
# Do not check any files in %%{_qt5_plugindir}/platformthemes/ for requires.
|
||||
# Those themes are there for platform integration. If the required libraries are
|
||||
|
@ -409,6 +411,7 @@ Qt5 libraries used for drawing widgets and OpenGL items.
|
|||
## upstream patches
|
||||
%patch100 -p1 -b .Do-not-load-plugin-from-the-PWD.patch
|
||||
%patch101 -p1 -b .QLibrary-Unix-do-not-attempt-to-load-a-library-relat
|
||||
%patch102 -p1 -b .QPSQL-Add-support-for-PostgreSQL-12
|
||||
|
||||
# move some bundled libs to ensure they're not accidentally used
|
||||
pushd src/3rdparty
|
||||
|
@ -1053,6 +1056,9 @@ fi
|
|||
|
||||
|
||||
%changelog
|
||||
* Sun Mar 22 2020 Robert-André Mauchin <zebob.m@gmail.com> - 5.13.2-4
|
||||
- Upstream patch to add support for PostgreSQL 12 (#1815921)
|
||||
|
||||
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 5.13.2-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
|
||||
|
||||
|
|
Loading…
Reference in New Issue