From 369d9292119a22417064771d3d642ee3981e7ed2 Mon Sep 17 00:00:00 2001 From: Tomas Kopecek Date: Jan 12 2023 10:02:48 +0000 Subject: PR#3615: fix different PG capabilities in schema Merges #3615 https://pagure.io/koji/pull-request/3615 Fixes: #3594 https://pagure.io/koji/issue/3594 schema update issue for 1.30->1.31 update --- diff --git a/docs/schema-upgrade-1.30-1.31.sql b/docs/schema-upgrade-1.30-1.31.sql index 2d311f4..eee9e74 100644 --- a/docs/schema-upgrade-1.30-1.31.sql +++ b/docs/schema-upgrade-1.30-1.31.sql @@ -2,6 +2,16 @@ -- from version 1.30 to 1.31 BEGIN; - -- index for default search method for rpms - CREATE INDEX rpminfo_filename ON rpminfo((name || '-' || version || '-' || release || '.' || arch || '.rpm')) INCLUDE (id); + -- index for default search method for rpms, PG11+ can benefit from new include method + DO $$ + DECLARE version integer; + BEGIN + SELECT current_setting('server_version_num')::integer INTO version; + IF version >= 110000 THEN + EXECUTE 'CREATE INDEX rpminfo_filename ON rpminfo((name || ''-'' || version || ''-'' || release || ''.'' || arch || ''.rpm'')) INCLUDE (id);'; + ELSE + EXECUTE 'CREATE INDEX rpminfo_filename ON rpminfo((name || ''-'' || version || ''-'' || release || ''.'' || arch || ''.rpm''));'; + END IF; + END + $$; COMMIT; diff --git a/docs/schema.sql b/docs/schema.sql index 39b7893..c2ea695 100644 --- a/docs/schema.sql +++ b/docs/schema.sql @@ -734,7 +734,18 @@ CREATE TABLE rpminfo ( CONSTRAINT rpminfo_unique_nvra UNIQUE (name,version,release,arch,external_repo_id) ) WITHOUT OIDS; CREATE INDEX rpminfo_build ON rpminfo(build_id); -CREATE INDEX rpminfo_filename ON rpminfo((name || '-' || version || '-' || release || '.' || arch || '.rpm')) INCLUDE (id); +-- index for default search method for rpms, PG11+ can benefit from new include method +DO $$ + DECLARE version integer; + BEGIN + SELECT current_setting('server_version_num')::integer INTO version; + IF version >= 110000 THEN + EXECUTE 'CREATE INDEX rpminfo_filename ON rpminfo((name || ''-'' || version || ''-'' || release || ''.'' || arch || ''.rpm'')) INCLUDE (id);'; + ELSE + EXECUTE 'CREATE INDEX rpminfo_filename ON rpminfo((name || ''-'' || version || ''-'' || release || ''.'' || arch || ''.rpm''));'; + END IF; + END +$$; -- sighash is the checksum of the signature header CREATE TABLE rpmsigs ( diff --git a/docs/source/supported_platforms.rst b/docs/source/supported_platforms.rst index af8be78..4622373 100644 --- a/docs/source/supported_platforms.rst +++ b/docs/source/supported_platforms.rst @@ -11,3 +11,9 @@ involves all active Fedoras and RHEL/CentOS 7+. +===========+=====+=====+=========+=======+=====+=====+ | Python | 3.6 | 3.6 | 2.7 | 3.6 | 2.7 | 2.7 | +-----------+-----+-----+---------+-------+-----+-----+ + +For database we're supporting RHEL/CentOS 8+. So, it means that +postgresl 10 is still supported, anyway we encourage using at +least PG 12 (``dnf module enable postgresql:12``). At least some +indices are set up in more efficient way with newer PG +capabilities.