File pg_qualstats.spec of Package pg_qualstats

#
# Copyright (c) 2021 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#

%define         pg_name @BUILD_FLAVOR@%{nil}
%define         ext_name pg_qualstats
%{pg_version_from_name}

Name:           %{pg_name}-%{ext_name}
Version:        2.1.2
Release:        0
Summary:        A PostgreSQL extension for collecting statistics about predicates, helping find what indices are missing
License:        MIT
Group:          Productivity/Databases/Tools
Url:            https://github.com/powa-team/pg_qualstats
Source:         https://github.com/powa-team/pg_qualstats/archive/refs/tags/%{version}.tar.gz#/%{ext_name}-%{version}.tar.gz

BuildRequires:  %{pg_name}-llvmjit-devel
%pg_server_requires
%if "%{pg_name}" == ""
ExclusiveArch:  do_not_build
%endif

%description
pg_qualstats is a PostgreSQL extension keeping statistics on predicates found
in ```WHERE``` statements and ```JOIN``` clauses.

This is useful if you want to be able to analyze what are the most-often
executed quals (predicates) on your database. The
[powa](http://powa.readthedocs.io/) project makes use of this to provide
advances index suggestions.

It also allows you to identify correlated columns, by identifying which columns
are most frequently queried together.

%prep
%autosetup -p1 -n %{ext_name}-%{version}

%build
%make_pgxs

%install
%make_install

%post
%{_datadir}/postgresql/install-alternatives %{pg_version}

%postun
%{_datadir}/postgresql/install-alternatives %{pg_version}

%files
%license LICENSE
%doc CHANGELOG README.md
%{pg_config_sharedir}/extension/%{ext_name}*
%{pg_config_pkglibdir}/%{ext_name}.so
%if %{postgresql_has_llvm}
%{pg_config_pkglibdir}/bitcode/*
%endif

%changelog
openSUSE Build Service is sponsored by