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
This commit is contained in:
Tomas Kopecek 2023-01-12 11:02:48 +01:00
commit 369d929211
3 changed files with 30 additions and 3 deletions

View file

@ -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;

View file

@ -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 (

View file

@ -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.