commit a42e261a2cc365f1f07e7673dc8d377b24d4aaa5 Author: ABF Date: Thu Mar 23 12:11:11 2023 +0000 Automatic import for version 15.2-1.res7 diff --git a/.abf.yml b/.abf.yml new file mode 100644 index 0000000..e852a36 --- /dev/null +++ b/.abf.yml @@ -0,0 +1,2 @@ +sources: + "postgresql-15.2.tar.bz2": 3725afaa8587583628bc36b813cb9eb2013aad28 diff --git a/1c.tune b/1c.tune new file mode 100755 index 0000000..93fcc64 --- /dev/null +++ b/1c.tune @@ -0,0 +1,68 @@ +#!/bin/sh +# This script generates set of configuration options +# tuned for 1C database + +limit() { + ## This function checks if first arg is within limits set by second + ## and third arg. If so, it prints out first arg, otherwise - limit + ## minimal limit should always be specified. maximal can be omitted + ## and would be considered infinity + computed="$1" + min="$2" + max="$3" + if [ "$computed" -lt "$min" ]; then + echo "$min" + elif [ -n "$max" ] && [ "$computed" -gt "$max" ]; then + echo "$max" + else + echo "$computed" + fi +} + +if [ "$1" != "--nocheck" ]; then +PREFIX=$(dirname $(dirname $0)) +EDVER=$(basename $PREFIX) +for module in plantuner online_analyze; do + if [ ! -e ${PREFIX}/lib/${module}.so ]; then + echo "Module $module is not found. Please install postgrespro-${EDVER}-contrib package" 1>&2 + exit 1 + fi +done +fi +# Number of CPUS +NCPU=$(nproc) +# Size of RAM in megabytes +RAMMB=$(LC_MESSAGES=C free -m|awk '/Mem:/ {print $2;}') +# This is set of options to be added to config + +cat << END_OF_CONF +listen_addresses = '*' +shared_buffers = $((RAMMB/4))MB # 25% of RAM +temp_buffers = 128MB +max_files_per_process = 10000 +max_parallel_workers_per_gather = 0 +max_parallel_maintenance_workers = $(limit $((NCPU/4)) 2 6) # Количество CPU/4, минимум 2, максимум 6 +commit_delay = 1000 +max_wal_size = 4GB +min_wal_size = 2GB +checkpoint_timeout = 15min +effective_cache_size = $((RAMMB*3/4))MB # 75% of RAM +from_collapse_limit = 8 +join_collapse_limit = 8 +autovacuum_max_workers = $(limit $((NCPU/2)) 2) # Количество CPU/2, минимум 2 +vacuum_cost_limit = $(limit $((NCPU*50)) 200) # 100* autovacuum_max_workers +autovacuum_naptime = 20s +autovacuum_vacuum_scale_factor = 0.01 +autovacuum_analyze_scale_factor = 0.005 +max_locks_per_transaction = 256 +escape_string_warning = off +standard_conforming_strings = off +shared_preload_libraries = 'online_analyze, plantuner' +online_analyze.threshold = 50 +online_analyze.scale_factor = 0.1 +online_analyze.enable = on +online_analyze.verbose = off +online_analyze.min_interval = 10000 +online_analyze.table_type = 'temporary' +plantuner.fix_empty_table = on +END_OF_CONF diff --git a/Makefile.regress b/Makefile.regress new file mode 100755 index 0000000..43c7ba4 --- /dev/null +++ b/Makefile.regress @@ -0,0 +1,67 @@ +# +# Simplified makefile for running the PostgreSQL regression tests +# in an RPM installation +# + +# maximum simultaneous connections for parallel tests +MAXCONNOPT = +ifdef MAX_CONNECTIONS +MAXCONNOPT += --max-connections=$(MAX_CONNECTIONS) +endif + +# locale +NOLOCALE = +ifdef NO_LOCALE +NOLOCALE += --no-locale +endif + +srcdir := . + +REGRESS_OPTS += --dlpath=. + +pg_regress_locale_flags = $(if $(ENCODING),--encoding=$(ENCODING)) $(NOLOCALE) + +pg_regress_installcheck = ./pg_regress --inputdir=$(srcdir) --psqldir='/usr/bin' $(pg_regress_locale_flags) + +# Test input and expected files. These are created by pg_regress itself, so we +# don't have a rule to create them. We do need rules to clean them however. +ifile_list := $(subst .source,, $(notdir $(wildcard $(srcdir)/input/*.source))) +input_files := $(foreach file, $(ifile_list), sql/$(file).sql) +ofile_list := $(subst .source,, $(notdir $(wildcard $(srcdir)/output/*.source))) +output_files := $(foreach file, $(ofile_list), expected/$(file).out) + +abs_srcdir := $(shell pwd) +abs_builddir := $(shell pwd) + +check: installcheck-parallel + +installcheck: cleandirs + $(pg_regress_installcheck) $(REGRESS_OPTS) --schedule=$(srcdir)/serial_schedule $(EXTRA_TESTS) + +installcheck-parallel: cleandirs + $(pg_regress_installcheck) $(REGRESS_OPTS) --schedule=$(srcdir)/parallel_schedule $(MAXCONNOPT) $(EXTRA_TESTS) + +# The tests command the server to write into testtablespace and results. +# On a SELinux-enabled system this will fail unless we mark those directories +# as writable by the server. +cleandirs: + -rm -rf testtablespace results + mkdir testtablespace results + [ -x /usr/bin/chcon ] && /usr/bin/chcon -u system_u -r object_r -t postgresql_db_t testtablespace results + +# old interfaces follow... + +runcheck: check +runtest: installcheck +runtest-parallel: installcheck-parallel + + +## +## Clean up +## + +clean distclean maintainer-clean: + rm -f $(output_files) $(input_files) + rm -rf testtablespace + rm -rf results tmp_check log + rm -f regression.diffs regression.out regress.out run_check.out diff --git a/big.conf.sample b/big.conf.sample new file mode 100644 index 0000000..867221a --- /dev/null +++ b/big.conf.sample @@ -0,0 +1,18 @@ +# DB Version: 9.6 +# OS Type: linux +# DB Type: oltp +# Total Memory (RAM): 128 GB +# Number of Connections: 1000 + +max_connections = 1000 +shared_buffers = 32GB +effective_cache_size = 96GB +work_mem = 33554kB +maintenance_work_mem = 2GB +min_wal_size = 2GB +max_wal_size = 4GB +checkpoint_completion_target = 0.9 +wal_buffers = 16MB +default_statistics_target = 100 + + diff --git a/buildinfo.txt b/buildinfo.txt new file mode 100644 index 0000000..f82f78e --- /dev/null +++ b/buildinfo.txt @@ -0,0 +1 @@ +SPEC file version: 87cbabd5d8742b84f2d3c75bae5c2a9884ac61d3 Tue Feb 14 11:30:28 2023 +0300 diff --git a/ecpg_config.h b/ecpg_config.h new file mode 100755 index 0000000..6fecfcb --- /dev/null +++ b/ecpg_config.h @@ -0,0 +1,29 @@ +/* + * Kluge to support multilib installation of both 32- and 64-bit RPMS: + * we need to arrange that header files that appear in both RPMs are + * identical. Hence, this file is architecture-independent and calls + * in an arch-dependent file that will appear in just one RPM. + * + * To avoid breaking arches not explicitly supported by Red Hat, we + * use this indirection file *only* on known multilib arches. + * + * Note: this may well fail if user tries to use gcc's -I- option. + * But that option is deprecated anyway. + */ +#if defined(__x86_64__) +#include "ecpg_config_x86_64.h" +#elif defined(__i386__) +#include "ecpg_config_i386.h" +#elif defined(__ppc64__) || defined(__powerpc64__) +#include "ecpg_config_ppc64.h" +#elif defined(__ppc__) || defined(__powerpc__) +#include "ecpg_config_ppc.h" +#elif defined(__s390x__) +#include "ecpg_config_s390x.h" +#elif defined(__s390__) +#include "ecpg_config_s390.h" +#elif defined(__sparc__) && defined(__arch64__) +#include "ecpg_config_sparc64.h" +#elif defined(__sparc__) +#include "ecpg_config_sparc.h" +#endif diff --git a/medium.conf.sample b/medium.conf.sample new file mode 100644 index 0000000..04725dd --- /dev/null +++ b/medium.conf.sample @@ -0,0 +1,18 @@ +# DB Version: 9.6 +# OS Type: linux +# DB Type: oltp +# Total Memory (RAM): 32 GB +# Number of Connections: 200 + +max_connections = 200 +shared_buffers = 8GB +effective_cache_size = 24GB +work_mem = 41943kB +maintenance_work_mem = 2GB +min_wal_size = 2GB +max_wal_size = 4GB +checkpoint_completion_target = 0.9 +wal_buffers = 16MB +default_statistics_target = 100 + + diff --git a/pg-wrapper.in b/pg-wrapper.in new file mode 100644 index 0000000..6a8c06f --- /dev/null +++ b/pg-wrapper.in @@ -0,0 +1,218 @@ +#!/bin/sh +PATH=/sbin:/bin:/usr/sbin:/usr/bin +NAME=`basename $0` +BINDIR=@BINDIR@ +MANDIR=@MANDIR@ +MANSUF=.gz +# List of possible names of man.config in the various distributions +MAN_CONFIGS="/etc/manpath.config /etc/man_db.conf /etc/man.config" + +USAGE_STRING="Usage: $0 links (update|remove)" + +make_ua_path() { + if [ -x /usr/sbin/update-alternatives ]; then + echo /usr/sbin/update-alternatives + else + if [ -x /usr/bin/update-alternatives ]; then + echo /usr/bin/update-alternatives + else + echo /sbin/update-alternatives + fi + fi +} + +update_man_config() { + for config in $MAN_CONFIGS; do + [ -f "$config" ] || continue + if ! grep $MANDIR "$config" >/dev/null; then + echo "Updating $config" + if [ "$config" = "/etc/man.config" ]; then + echo "MANPATH $MANDIR" >> "$config" + else + echo "MANDATORY_MANPATH $MANDIR" >> "$config" + fi + fi + done +} + +cleanup_man_config() { + for config in $MAN_CONFIGS; do + [ -f "$config" ] || continue + if grep $MANDIR "$config" >/dev/null; then + echo "Updating $config" + MANDIR_PATTERN=`echo $MANDIR | sed -e 's,\/,\\\/,g'` + if [ "$config" = "/etc/man.config" ]; then + sed -i.bak "/MANPATH $MANDIR_PATTERN/d" "$config" && rm -f "${config}.bak" + else + sed -i.bak "/MANDATORY_MANPATH $MANDIR_PATTERN/d" "$config" && rm -f "${config}.bak" + fi + fi + done +} + +update_links() { + BINLIST=`ls $BINDIR` + MAN1LIST=`ls $MANDIR/man1` + MAN1RULIST=`ls $MANDIR/ru/man1` + UA=`make_ua_path` + if [ -x $UA ] && [ ! "`realpath $UA 2>/dev/null`" = "/bin/true" ]; then + man_installed=0 + for name in $BINLIST; do + $UA --install /usr/bin/$name pgsql-${name} $BINDIR/pg-wrapper @VERSION@00 + done + for name in $MAN1LIST; do + name=`echo $name | sed -e 's/\.1.*//g'` + $UA --install /usr/share/man/man1/${name}.1${MANSUF} pgsql-${name}man $MANDIR/man1/${name}.1${MANSUF} @VERSION@00 && man_installed=1 + done + + if [ ! -d /usr/share/man/ru/man1 ]; then + mkdir -p /usr/share/man/ru/man1 + fi + for name in $MAN1RULIST; do + name=`echo $name | sed -e 's/\.1.*//g'` + $UA --install /usr/share/man/ru/man1/${name}.1${MANSUF} pgsql-${name}manru $MANDIR/ru/man1/${name}.1${MANSUF} @VERSION@00 + done + + if [ $man_installed -eq 1 ]; then + update_man_config + fi + else + bin_ready=1 + man_ready=1 + man_ru_ready=1 + for name in $BINLIST; do + if [ -f /usr/bin/$name ] && [ ! -L /usr/bin/$name ]; then + echo "Warning: skipping binary link setup. Binary file already exists: /usr/bin/$name" + bin_ready=0 + fi + done + for name in $MAN1LIST; do + name=`echo $name | sed -e 's/\.1.*//g'` + if [ -f /usr/share/man/man1/${name}.1${MANSUF} ] && [ ! -L /usr/share/man/man1/${name}.1${MANSUF} ]; then + echo "Warning: skipping man page setup. Man page with the same name already exists: /usr/share/man/man1/${name}.1${MANSUF}" + man_ready=0 + fi + done + for name in $MAN1RULIST; do + name=`echo $name | sed -e 's/\.1.*//g'` + if [ -f /usr/share/man/ru/man1/${name}.1${MANSUF} ] && [ ! -L /usr/share/man/ru/man1/${name}.1${MANSUF} ]; then + echo "Warning: skipping man page setup. Man page with the same name already exists: /usr/share/man/ru/man1/${name}.1${MANSUF}" + man_ru_ready=0 + fi + done + if [ $bin_ready -eq 1 ] && [ $man_ready -eq 1 ] && [ $man_ru_ready -eq 1 ]; then + for name in $BINLIST; do + echo "Creating link for /usr/bin/$name" + ln -snf $BINDIR/pg-wrapper /usr/bin/$name + done + for name in $MAN1LIST; do + name=`echo $name | sed -e 's/\.1.*//g'` + echo "Creating link for /usr/share/man/man1/${name}.1${MANSUF}" + ln -snf $MANDIR/man1/${name}.1${MANSUF} /usr/share/man/man1/${name}.1${MANSUF} + done + if [ ! -d /usr/share/man/ru/man1 ]; then + mkdir -p /usr/share/man/ru/man1 + fi + for name in $MAN1RULIST; do + name=`echo $name | sed -e 's/\.1.*//g'` + echo "Creating link for /usr/share/man/ru/man1/${name}.1${MANSUF}" + ln -snf $MANDIR/ru/man1/${name}.1${MANSUF} /usr/share/man/ru/man1/${name}.1${MANSUF} + done + + update_man_config + fi + fi +} + +remove_links() { + BINLIST=`ls $BINDIR` + MAN1LIST=`ls $MANDIR/man1` + MAN1RULIST=`ls $MANDIR/ru/man1` + UA=`make_ua_path` + if [ -x $UA ] && [ ! "`realpath $UA`" = "/bin/true" ] 2>/dev/null; then + for name in $BINLIST; do + $UA --remove pgsql-$name $BINDIR/pg-wrapper + done + for name in $MAN1LIST; do + name=`echo $name | sed -e 's/\.1.*//g'` + $UA --remove pgsql-${name}man $MANDIR/man1/${name}.1${MANSUF} + done + for name in $MAN1RULIST; do + name=`echo $name | sed -e 's/\.1.*//g'` + $UA --remove pgsql-${name}manru $MANDIR/ru/man1/${name}.1${MANSUF} + done + else + PGHOME=`/usr/bin/dirname $BINDIR` + for name in $BINLIST; do + if [ -L /usr/bin/$name ] ; then + path=`readlink /usr/bin/$name` + if echo $path | grep $PGHOME >/dev/null; then + echo "Removing link for /usr/bin/$name" + rm -f /usr/bin/$name + fi + fi + done + for name in $MAN1LIST; do + name=`echo $name | sed -e 's/\.1.*//g'` + if [ -L /usr/share/man/man1/${name}.1${MANSUF} ] ; then + path=`readlink /usr/share/man/man1/${name}.1${MANSUF}` + if echo $path | grep $PGHOME >/dev/null; then + echo "Removing link for /usr/share/man/man1/${name}.1${MANSUF}" + rm -f /usr/share/man/man1/${name}.1${MANSUF} + fi + fi + done + for name in $MAN1RULIST; do + name=`echo $name | sed -e 's/\.1.*//g'` + if [ -L /usr/share/man/ru/man1/${name}.1 ] ; then + path=`readlink /usr/share/man/ru/man1/${name}.1${MANSUF}` + if echo $path | grep $PGHOME >/dev/null; then + echo "Removing link for /usr/share/man/ru/man1/${name}.1${MANSUF}" + rm -f /usr/share/man/ru/man1/${name}.1${MANSUF} + fi + fi + done + fi + + cleanup_man_config + +} + +links() { + case "$1" in + update) + shift + update_links $@ + ;; + remove) + shift + remove_links $@ + ;; + *) + echo >&2 "$USAGE_STRING" + exit 2 + esac +} + +if [ -z "$NAME" ]; then + echo "Error: failed to extract basename of $0" + exit 1 +fi + +if [ "$NAME" = "pg-wrapper" ]; then + case "$1" in + links) + shift + if [ $(id -u) -ne 0 ]; then + echo "Links management requires root privileges" >&2 + exit 1; + fi + links $@ + ;; + *) + echo >&2 "$USAGE_STRING" + exit 2 + esac +else + exec $BINDIR/$NAME ${1:+"$@"} +fi diff --git a/pg_config.h b/pg_config.h new file mode 100755 index 0000000..97ef2ba --- /dev/null +++ b/pg_config.h @@ -0,0 +1,29 @@ +/* + * Kluge to support multilib installation of both 32- and 64-bit RPMS: + * we need to arrange that header files that appear in both RPMs are + * identical. Hence, this file is architecture-independent and calls + * in an arch-dependent file that will appear in just one RPM. + * + * To avoid breaking arches not explicitly supported by Red Hat, we + * use this indirection file *only* on known multilib arches. + * + * Note: this may well fail if user tries to use gcc's -I- option. + * But that option is deprecated anyway. + */ +#if defined(__x86_64__) +#include "pg_config_x86_64.h" +#elif defined(__i386__) +#include "pg_config_i386.h" +#elif defined(__ppc64__) || defined(__powerpc64__) +#include "pg_config_ppc64.h" +#elif defined(__ppc__) || defined(__powerpc__) +#include "pg_config_ppc.h" +#elif defined(__s390x__) +#include "pg_config_s390x.h" +#elif defined(__s390__) +#include "pg_config_s390.h" +#elif defined(__sparc__) && defined(__arch64__) +#include "pg_config_sparc64.h" +#elif defined(__sparc__) +#include "pg_config_sparc.h" +#endif diff --git a/postgrespro-check-db-dir.in b/postgrespro-check-db-dir.in new file mode 100755 index 0000000..1f312d9 --- /dev/null +++ b/postgrespro-check-db-dir.in @@ -0,0 +1,47 @@ +#!/bin/sh + +# This script verifies that the postgrespro data directory has been correctly +# initialized. We do not want to automatically initdb it, because that has +# a risk of catastrophic failure (ie, overwriting a valuable database) in +# corner cases, such as a remotely mounted database on a volume that's a +# bit slow to mount. But we can at least emit a message advising newbies +# what to do. +PATH=/bin:/usr/bin +export PATH +PGDATA="$1" + +if [ -z "$PGDATA" ] +then + echo "Usage: $0 database-path" + exit 1 +fi + +PGENGINE=@BINDIR@ +PGMAJORVERSION=@VERSION@ +PREVMAJORVERSION=10 + +# Check for the PGDATA structure +if [ -f "$PGDATA/PG_VERSION" ] && [ -d "$PGDATA/base" ] +then + # Check version of existing PGDATA + if [ "$(cat "$PGDATA/PG_VERSION")" = "$PGMAJORVERSION" ] + then + exit 0 + elif [ "$(cat "$PGDATA/PG_VERSION")" = "$PREVMAJORVERSION" ] + then + echo "An old version of the database format was found." + echo "Use \"${PGENGINE}/pg_upgrade\" to upgrade to version $PGMAJORVERSION." + exit 1 + else + echo "An old version of the database format was found." + echo "You need to dump and reload before using Postgres Pro @EDITION@-$PGMAJORVERSION." + exit 1 + fi +else + # No existing PGDATA! Warn the user to initdb it. + echo "\"$PGDATA\" is missing or empty." + echo "Use \"${PGENGINE}/pg-setup initdb\" to initialize the database cluster." + exit 1 +fi + +exit 0 diff --git a/postgrespro-setup.in b/postgrespro-setup.in new file mode 100644 index 0000000..7944a1a --- /dev/null +++ b/postgrespro-setup.in @@ -0,0 +1,482 @@ +#!/bin/sh +# +# postgrespro-setup Initialization and control operations for Postgres Pro +# + +PG_SETUP_VERSION=13.2.1 +BINDIR=@BINDIR@ +SERVICE=@PROGNAME@-@EDITION@-@VERSION@ +PGENGINE=$BINDIR + +OU_STRING="" +if [ "ent" = "@EDITION@" ] && [ "@VERSION@" -ge 13 ]; then + OU_STRING=" [--enable-online-upgrade]" +fi + +USAGE_STRING="Usage: $0 initdb [] + or: $0 find-free-port + or: $0 set-server-port + or: $0 service (enable|disable) + or: $0 service (start|stop|condrestart|status) + or: $0 set GUC-variable value + or: $0 psql [] + +Script is aimed to help sysadmin with basic database cluster administration. + +Available operation mode: + initdb [--tune=conf]${OU_STRING} [] Create a new Postgres Pro database cluster. + find-free-port Search of free server TCP-port number, start with 5432. + set-server-port Set server port number. + service enable Enable service. + service disable Disable service. + service status Service status. + service start Start service. + service stop Stop service. + service condrestart Conditional restart of service. + + pg-setup psql allows to start SQL shell correctly switching from root + to postgres user and use port set by pg-setup set-server-port. +" + +# note that these options are useful at least for help2man processing +case "$1" in + --version) + echo "pg-setup $PG_SETUP_VERSION" + exit 0 + ;; + --help|--usage) + echo "$USAGE_STRING" + exit 0 + ;; + "") + echo "$USAGE_STRING" + exit 1 + ;; +esac + +if [ "$(id -u)" -ne 0 ]; then + echo "$0 must be started as root" >&2 + exit 1 +fi + +PGDATA=/var/lib/pgpro/@EDITION@-@VERSION@/data +DEFCONFIG=/etc/default/postgrespro-@EDITION@-@VERSION@ +# shellcheck disable=SC1090 +[ -f $DEFCONFIG ] && . $DEFCONFIG +export PGDATA +# make safe PATH +PATH=/sbin:/bin:/usr/sbin:/usr/bin:@BINDIR@ +export PATH + +# For SELinux we need to use 'runuser' not 'su' +if [ -x /sbin/runuser ] +then + SU=/sbin/runuser +else + SU=su +fi + +# +# This function sets confguration value in the postgresql.conf to given +# string. If value should contain quotes, they should be passed as part +# of string +# i.e. set_conf_value log_destination "'stderr'" +# Keeps end of line comments if it can. +# Removes corresponding paramters from postgresql.auto.conf if any +# FIXME - this function is unable to handle arbitrary includes, +# but possibly would do a right thing, because if directive is in the +# include, it would not find it in the main configuration file +# and append new value to the end of it after all includes. + +set_conf_value() { + param="$1" + value="$2" + config="$PGDATA/postgresql.conf" + if [ ! -f "$config" ]; then + echo "Cannot find configuration file for $PGDATA!" >&2 + return 1 + fi + + # Check if there is (possibly commented out) parameter in the config + if grep -q "^#\\?${param}[ ]*=" "$config"; then + # Found one edit + sed -i "s/^#\\?${param}[ ]*=[ ]*[^#]*\\(#.*\\)\\?/$param = $value \\1/" \ + "$config" + else + # Not found, just append + echo "$param = $value" >> "$config" + fi + # Check postgresql.auto.conf + if [ -f "$PGDATA/postgresql.auto.conf" ] && grep -q "^${param}[ ]*=" "$PGDATA/postgresql.auto.conf"; then + #Really we could call sed without previous check, but + #I want to keep file timestamp if there is nothing to change + sed -i "/^${param}[ ]*=/d" "$PGDATA/postgresql.auto.conf"; + fi +} + +# +# This function checks whether environment variable needs shell +# quoting. Pass there unquited variable and function will return +# 0 if it got more than one argument and 1 if just one +need_quotes() { + [ "$#" -gt 1 ] +} +# +# This function checks whether existing directory does contain any files +# and subdirectories +# +dir_is_not_empty() { + [ "$(ls -A "$1")" ] +} + +initdb(){ + INITDB_OPTIONS="" + datadir="" + TUNE=@EDITION@ + ENABLE_ONLINE_UPGRADE=0 + for opt in "$@"; do + if [ -n "$consume_next" ]; then + datadir="$opt" + consume_next="" + continue + fi + case "$opt" in + -D|--pgdata) + if [ -n "$datadir" ]; then + echo "Duplicate option $opt" 1>&2 + return 1 + fi + consume_next=1 + ;; + --pgdata=*) + if [ -n "$datadir" ]; then + echo "Duplicate option --pgdata" 1>&2 + return 1 + fi + datadir=$(echo "$opt"|sed 's/^[^=]*=//') + ;; + --auth-local=*) + if [ -n "$local_auth" ]; then + echo "Duplicate option --auth-local" 1>&2 + return 1 + fi + local_auth=$opt + ;; + --auth-host=*) + if [ -n "$host_auth" ]; then + echo "Duplicate option --auth-host" 1>&2 + return 1 + fi + host_auth=$opt + ;; + --tune|--auth-local|-auth-host) + echo "Please use syntax $opt=value" >&2; + return 1 + ;; + --tune=*) + TUNE=${opt#*=} + ;; + --enable-online-upgrade) + ENABLE_ONLINE_UPGRADE=1 + ;; + *) + INITDB_OPTIONS="$INITDB_OPTIONS \"$opt\"" + ;; + esac + done + if [ -n "$datadir" ]; then + # shellcheck disable=SC2166 + if [ "$datadir" != "$PGDATA" -a -f ${DEFCONFIG} ]; then + echo "${DEFCONFIG} already exists " >&2 + echo "And sets up database location $PGDATA." >&2 + echo "If you want to setup second postgres instance in" >&2 + echo "$datadir" >&2 + echo "use @BINDIR@/initdb directly and configure service" >&2 + echo "startup manually." >&2 + return 1 + fi + PGDATA="$datadir" + export PGDATA + fi + # Check for relative path + if [ ! -d "$PGDATA" ]; then + mkdir -p "$PGDATA" || return 1 + elif dir_is_not_empty "$PGDATA" ; then + echo "Data directory $PGDATA is not empty!" 1>&2 + return 1 + fi + # convert path to PGDATA to absolute + PGDATA="$(sh -c "cd '$PGDATA' && pwd -P")" + + chown postgres:postgres "$PGDATA" + chmod go-rwx "$PGDATA" + # We intend word splitting here. This line checks if + # PGDATA would be splitted + # shellcheck disable=SC2086 + if need_quotes $PGDATA ; then + echo "PGDATA=\"$PGDATA\"" > "${DEFCONFIG}" + else + echo "PGDATA=$PGDATA" > "${DEFCONFIG}" + fi + if [ "$ENABLE_ONLINE_UPGRADE" = "1" ]; then + echo "ENABLE_ONLINE_UPGRADE=1" >> "${DEFCONFIG}" + fi + PGLOG="$(dirname "${PGDATA}")/initdb.$(basename "${PGDATA}").log" + # Clean up SELinux tagging for PGDATA + RESTORECON=/sbin/restorecon + [ -x $RESTORECON ] && $RESTORECON "$PGDATA" + # Check if locale of this script is suitable for creating database + # and try to find better one if not + if [ "$(locale charmap)" = "ANSI_X3.4-1968" ]; then + # If current locale is 7-bit, try to get locale of + # invoking user or default locale of user postgres, + # shellcheck disable=SC2046 + eval $($SU - "${SUDO_USER:-postgres}" -c locale) + [ -z "$LANG" ] || export LANG + [ -z "$LC_CTYPE" ] || export LC_CTYPE + elif [ -z "$LANG" ]&&[ -n "$LC_CTYPE" ]; then + # If LC_CTYPE set to something usable, but LANG is unset, + # set it equal to LC_CTYPE, because we need LC_COLLATE as well + # as LC_CTYPE + LANG="$LC_CTYPE" + export LANG + fi + # if locale still C or POSIX, use C.UTF-8 + if [ "$(locale charmap)" = "ANSI_X3.4-1968" ]; then + LANG=C.UTF-8 + [ -z "$LC_CTYPE" ] || LC_CTYPE="$LANG" + [ -z "$LC_COLLATE" ] || LC_COLLATE="$LANG" + [ -z "$LC_ALL" ] || LC_ALL="$LANG" + [ -z "$LC_ALL" ] || export LC_ALL + fi + # Create the initdb log file if needed + # shellcheck disable=SC2166 + if [ -f "$PGLOG" -o ! -e "$PGLOG" ]; then + if ! : > "$PGLOG" ; then + echo "Cannot write installation log file $PGLOG" >&2 + rm -rf "${PGDATA}" "${DEFCONFIG}" + return 1 + fi + chown postgres:postgres "$PGLOG" + chmod go-wx "$PGLOG" + [ -x $RESTORECON ] && $RESTORECON "$PGLOG" + else + echo "Log file $PGLOG exist and is not regular file. Cannot continue." >&2 + rm -rf "${PGDATA}" "${DEFCONFIG}" + return 1 + fi + + # Initialize the database + initdbcmd="$PGENGINE/initdb --pgdata='$PGDATA' ${local_auth:---auth-local=peer} ${host_auth:---auth-host=md5} $INITDB_OPTIONS" + echo "Initalizing database..." + if $SU -l postgres -c "LANG=$LANG $initdbcmd" >> "$PGLOG" 2>&1 < /dev/null; then + # Create directory for postmaster log files + mkdir "$PGDATA/log" + chown postgres:postgres "$PGDATA/log" + chmod go-rwx "$PGDATA/log" + [ -x $RESTORECON ] && $RESTORECON "$PGDATA/log" + # Tune configuration + if [ -x "@PREFIX@/share/$TUNE.tune" ]; then + if ! "@PREFIX@/share/$TUNE.tune" >> "$PGDATA/postgresql.conf"; then + rm -rf "${PGDATA}" "${DEFCONFIG}" + return 1 + fi + if grep -q "^listen_addresses[ ]*=[ ]*'\\*'" "$PGDATA/postgresql.conf" + then + echo "host all all 0.0.0.0/0 md5" >> "$PGDATA/pg_hba.conf" + fi + fi + # Fix shared_memory_type for online-upgrade + if [ "$ENABLE_ONLINE_UPGRADE" = "1" ]; then + set_conf_value "shared_memory_type" "sysv" + fi + # Fix configuration file to enable loging_collector + if set_conf_value "logging_collector" "on"; then + echo OK + return 0 + fi + fi + rm -rf "${PGDATA}" "${DEFCONFIG}" + echo "failed, see $PGLOG" 1>&2 + return 1 +} + +find_free_port() { + free_port=5432 + while /usr/bin/timeout 5 /bin/bash -c "cat < /dev/null > /dev/tcp/127.0.0.1/$free_port" 2>/dev/null; do + # shellcheck disable=SC2003 + free_port=$((free_port + 1)) + done + echo $free_port +} + +set_server_port(){ + port=$1 + if [ -z "$port" ]; then + echo "Error: port value is empty!" >&2 + return 1 + fi + # shellcheck disable=SC2003 + if ! /usr/bin/expr "$port" + 0 >/dev/null >&2; then + echo "Bad port value: $port" 1>&2 + return 1 + fi + # shellcheck disable=SC2166 + if [ "$port" -lt 1024 -o "$port" -gt 65535 ]; then + echo "Port value $port is out of range (1024-65535)" 1>&2; + return 1 + fi + set_conf_value "port" "$port" +} + +enable_service() { + if [ -n "$SCTL" ]; then + $SCTL enable $SERVICE + return $? + else + URCD=/usr/sbin/update-rc.d + if [ -x $URCD ]; then + $URCD $SERVICE defaults + else + /sbin/chkconfig --add $SERVICE + /sbin/chkconfig --level 35 $SERVICE on + fi + return $? + fi +} + +disable_service() { + if [ -n "$SCTL" ]; then + $SCTL disable $SERVICE + return $? + else + URCD=/usr/sbin/update-rc.d + if [ -x $URCD ]; then + $URCD -f $SERVICE remove + else + /sbin/chkconfig --del $SERVICE + fi + return $? + fi +} + +start_service() { + if [ -n "$SCTL" ]; then + $SCTL is-active --quiet $SERVICE || $SCTL start $SERVICE + return $? + else + SS=/usr/sbin/service + if [ -x /sbin/service ]; then + SS=/sbin/service + fi + $SS $SERVICE start + return $? + fi +} + +status_service() { + if [ -n "$SCTL" ]; then + $SCTL status $SERVICE + return $? + else + SS=/usr/sbin/service + if [ -x /sbin/service ]; then + SS=/sbin/service + fi + $SS $SERVICE status + return $? + fi +} + +stop_service() { + if [ -n "$SCTL" ]; then + $SCTL stop $SERVICE + return $? + else + SS=/usr/sbin/service + if [ -x /sbin/service ]; then + SS=/sbin/service + fi + $SS $SERVICE stop + return $? + fi +} + +condrestart_service() { + if [ -n "$SCTL" ]; then + if $SCTL 1>/dev/null 2>/dev/null; then + $SCTL condrestart $SERVICE + return $? + fi + else + SS=/usr/sbin/service + if [ -x /sbin/service ]; then + SS=/sbin/service + fi + $SS $SERVICE condrestart + return $? + fi +} + +service() { + if [ ! -f ${DEFCONFIG} ]; then + echo "Default database not found. Use $0 initdb to create it" 2>&1 + if [ "$1" = "enable" ]; then + return 1 + else + return 0 + fi + fi + SCTL="" + # shellcheck disable=2166 + if [ -d "/run/systemd/system" -a -x "/bin/systemctl" ]; then + SCTL=/bin/systemctl + fi + export SCTL + cmd=$1 + shift + case "${cmd}" in + start|stop|enable|disable|status|condrestart) + "${cmd}_service" "$@" + + ;; + *) + echo >&2 "$USAGE_STRING" + exit 2 + esac +} + +command="$1" +shift + +case "$command" in + initdb) + # We want wordsplitting here + # shellcheck disable=SC2086 + initdb "$@" $PGSETUP_INITDB_OPTIONS || exit 1 + ;; + find-free-port) + find_free_port "$@" || exit 1 + ;; + set-server-port) + set_server_port "$@" || exit 1 + ;; + service) + service "$@" || exit 1 + ;; + set) + set_conf_value "$@" || exit 1 + ;; + psql) + if [ ! -f "$PGDATA/postgresql.conf" ]; then + echo "Database in $PGDATA not found. Do you need pg-setup initdb first?" 1>&2 + exit 1; + fi + PORT=$(sed -n 's/^port[ ]*=[ ]*\([0-9]\+\)/\1/p' "$PGDATA/postgresql.conf") + $SU -l postgres -c "exec ${BINDIR}/psql ${PORT:+-p ${PORT}} $*" + ;; + *) + echo >&2 "$USAGE_STRING" + exit 2 + ;; +esac diff --git a/postgrespro.init.in b/postgrespro.init.in new file mode 100755 index 0000000..abbb065 --- /dev/null +++ b/postgrespro.init.in @@ -0,0 +1,143 @@ +#!/bin/sh +# Start/stop the Postgres Pro @EDITION@ database server. +# +### BEGIN INIT INFO +# Provides: postgrespro-@EDITION@-@VERSION@ +# Required-Start: $local_fs $remote_fs $network $time +# Required-Stop: $local_fs $remote_fs $network $time +# Should-Start: $syslog +# Should-Stop: $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Postgres Pro database server +### END INIT INFO + +# shellcheck disable=SC1091 +. /lib/lsb/init-functions + +NAME=postgrespro-@EDITION@-@VERSION@ + +# For SELinux we need to use 'runuser' not 'su' +if [ -x /sbin/runuser ] +then + SU=runuser +else + SU=su +fi + +# Set defaults for configuration variables +BINDIR=@BINDIR@ +PGDATA=/var/lib/pgpro/@EDITION@-@VERSION@/data +lockfile=/var/run/${NAME}.lock +pidfile="/var/run/${NAME}.pid" +# Override defaults from /etc/default/${NAME} if file is present +DEFCONFIG=/etc/default/${NAME} +PG_OOM_ADJUST_VALUE=0 +PG_OOM_ADJUST_FILE=/proc/self/oom_score_adj +export PG_OOM_ADJUST_FILE PG_OOM_ADJUST_VALUE +# shellcheck disable=SC1090 +[ -f $DEFCONFIG ] && . $DEFCONFIG +export PG_OOM_AJUST_VALUE +PGLOG="$(dirname "$PGDATA")/pgstartup-$(basename "$PGDATA").log" +export PGDATA + +script_result=0 + +start(){ + $SU -l postgres -c "${BINDIR}/check-db-dir $PGDATA" + + echo -n "Starting ${NAME} service" "postgrespro-@EDITION@-@VERSION@" + echo -1000 > "$PG_OOM_ADJUST_FILE" + $SU -l postgres -c "PG_OOM_ADJUST_FILE=$PG_OOM_ADJUST_FILE PG_OOM_ADJUST_VALUE=$PG_OOM_ADJUST_VALUE _ADJPATH=@BINDIR@:/usr/bin:/usr/sbin:/bin:/sbin ${BINDIR}/postmaster -D '$PGDATA' ${PGOPTS} &" >> "$PGLOG" 2>&1 < /dev/null + sleep 2 + pid=$(head -n 1 "$PGDATA/postmaster.pid" 2>/dev/null) + if [ "x$pid" != x ] + then + if kill -0 "$pid"; then + log_success_msg OK + else + log_failure_msg FAILED + fi + touch "$lockfile" + echo "$pid" > "$pidfile" + echo + else + log_failure_msg FAILED + script_result=1 + fi +} + +stop(){ + echo -n "Stopping ${NAME} service" "postgrespro-@EDITION@-@VERSION@" + if [ -e "$lockfile" ] + then + + $SU -l postgres -c "${BINDIR}/pg_ctl stop -D '$PGDATA' -s -m fast" > /dev/null 2>&1 < /dev/null + ret=$? + if [ $ret -eq 0 ] + then + log_success_msg STOPPED + rm -f "$pidfile" + rm -f "$lockfile" + else + log_failure_msg FAILED + script_result=1 + fi + else + # not running; per LSB standards this is "ok" + log_success_msg OK + fi + echo +} + +restart(){ + stop + start +} + +condrestart(){ + # shellcheck disable=SC2015 + [ -e "$lockfile" ] && restart || : +} + +reload(){ + $SU -l postgres -c "${BINDIR}/pg_ctl reload -D '$PGDATA' -s" > /dev/null 2>&1 < /dev/null +} + +promote(){ + $SU -l postgres -c "${BINDIR}/pg_ctl promote -D '$PGDATA' -s" > /dev/null 2>&1 < /dev/null +} + +# See how we were called. +case "$1" in + start) + start + ;; + stop) + stop + ;; + status) + $SU -l postgres -c "${BINDIR}/pg_ctl status -D '$PGDATA'" + script_result=$? + ;; + restart) + restart + ;; + promote) + promote + ;; + condrestart|try-restart) + condrestart + ;; + reload) + reload + ;; + force-reload) + restart + ;; + *) + echo "Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|promote}" + exit 2 +esac + +exit $script_result diff --git a/postgrespro.pam b/postgrespro.pam new file mode 100755 index 0000000..1d78594 --- /dev/null +++ b/postgrespro.pam @@ -0,0 +1,3 @@ +#%PAM-1.0 +auth include password-auth +account include password-auth diff --git a/postgrespro.service.in b/postgrespro.service.in new file mode 100644 index 0000000..1f58bd8 --- /dev/null +++ b/postgrespro.service.in @@ -0,0 +1,49 @@ +# It's not recommended to modify this file in-place, because it will be +# overwritten during package upgrades. If you want to customize, the +# best way is to create a file "/etc/systemd/system/postgrespro-10.service", +# containing +# .include /lib/systemd/system/postgrespro-10.service +# ...make your changes here... +# For more info about custom unit files, see +# http://fedoraproject.org/wiki/Systemd#How_do_I_customize_a_unit_file.2F_add_a_custom_unit_file.3F + +# Note: changing PGDATA will typically require adjusting SELinux +# configuration as well. + +# Note: do not use a PGDATA pathname containing spaces, or you will +# break pg-setup. +[Unit] +Description=Postgres Pro @EDITION@ @VERSION@ database server +After=syslog.target +After=network.target + +[Service] +Type=notify + +User=postgres +Group=postgres + +OOMScoreAdjust=-1000 +Environment=PG_OOM_ADJUST_FILE=/proc/self/oom_score_adj +Environment=PG_OOM_ADJUST_VALUE=0 +Environment=PATH=@BINDIR@:/usr/sbin:/usr/bin:/bin:/sbin +# Location of database directory +EnvironmentFile=/etc/default/postgrespro-@EDITION@-@VERSION@ + +# Where to send early-startup messages from the server (before the logging +# options of postgresql.conf take effect) +# This is normally controlled by the global default set by systemd +# StandardOutput=syslog + +# Disable OOM kill on the postmaster +ExecStartPre=@BINDIR@/check-db-dir ${PGDATA} +ExecStart=@BINDIR@/postgres -D ${PGDATA} +ExecReload=/bin/kill -HUP $MAINPID +KillMode=mixed +KillSignal=SIGINT + +# Give a reasonable amount of time for the server to start up/shut down +TimeoutSec=300 + +[Install] +WantedBy=multi-user.target diff --git a/postgrespro.spec b/postgrespro.spec new file mode 100644 index 0000000..3080f0e --- /dev/null +++ b/postgrespro.spec @@ -0,0 +1,2000 @@ +# -*- mode: rpm-spec; coding: utf-8 -*- +%if "%edition" == "sdm" +Requires: libev-devel +%endif +%global prog_name postgrespro +%global short_prog_name pgpro +%global edition 1c +%global edition_suffix -1c +%global edition_label 1c +%global pgsql_major 15 +%global certification 0 + +%if %pgsql_major == 10 +%global docformat xml +%else +%global docformat sgml +%endif + +%global _unpackaged_files_terminate_build 1 + +%global pgsql_version %{version} + +%if "%edition" == "1c" +%global tarname postgresql-%{version} +%else +%global tarname %{prog_name}%{edition_suffix}-%{version} +%endif + +%global pgbaseinstdir /opt/%short_prog_name/%edition-%{pgsql_major} +%global bindir %pgbaseinstdir/bin +%global libdir %pgbaseinstdir/lib +%global unitdir %{_unitdir} +%global initddir %_initddir +%global datadir %pgbaseinstdir/share +%global mandir %datadir/man +%global docdir %pgbaseinstdir/doc +%global sysconfdir %pgbaseinstdir/etc +%global includedir %pgbaseinstdir/include +%global pgdir /var/lib/%{short_prog_name}/%{edition}-%{pgsql_major} +%global pgdatadir %{pgdir}/data + +# compatibility layer +%global packageversion %{pgsql_major} +%global prevmajorversion 10 + +%if 0%{?rosa_ver} +%global rosa_rel %(sed -e 's/^.*[^.]\\([0-9]\\.[0-9]\\+\\).*$/\\1/' /etc/rosa-release) +%if "%{rosa_rel}" == "7.3" +%global rosa73 1 +%endif +%endif + +%if 0%{?redos} +%global redos_rel %(sed -e 's/^.*[^.]\\([0-9]\\.[0-9]\\+\\).*$/\\1/' /etc/redos-release) +%if "%{redos_rel}" >= "7.3" +%global redos73 1 +%endif +%endif +%if "%{_vendor}" == "suse" +%if "%{sle_version}" >= "120000" && "%{sle_version}" < "149999" +%global suse12 1 +%endif +%endif + +%if "%{_vendor}" == "suse" +%global suse 1 +%if 0%{?sle_version} == 0 +%global sle_version 110000 +%endif +%define dist .sles%(expr %{sle_version} / 10000) +%if "%{sle_version}" < "120000" +%global suse11 1 +%else +%global suse11 0 +%endif +%if "%{sle_version}" > "149999" +%global suse15 1 +%else +%global suse15 0 +%global jit 0 +%endif +%else +%global suse 0 +%global suse11 0 +%global suse15 0 +%endif +%{!?kerbdir:%global kerbdir "/usr"} +%{!?test:%global test 1} +%if ! 0%{?el9} && %{pgsql_major} < 15 +%else +# No python 2 in RHEL 9 +%endif +%if 0%{?el9} || %{pgsql_major} > 14 +%global plpython2 0 +%else +%global plpython2 1 +%endif +%{!?plpython:%global plpython 1} +%{!?pltcl:%global pltcl 1} +%{!?plperl:%global plperl 1} +%{!?ssl:%global ssl 1} +%{!?intdatetimes:%global intdatetimes 1} +%{!?kerberos:%global kerberos 1} +%{!?nls:%global nls 1} +%{!?xml:%global xml 1} +%{!?pam:%global pam 1} +%{!?disablepgfts:%global disablepgfts 0} +%{!?runselftest:%global runselftest 0} +%{!?uuid:%global uuid 1} +%{!?ldap:%global ldap 1} +%if "%{edition}" == "ent" +%{!?zstd:%global zstd 1} +%{!?rsocket:%global rsocket 1} +%else +%if %{pgsql_major} > 14 || "%{edition}" == "sdm" +%{!?zstd:%global zstd 1} +%else +%{!?zstd:%global zstd 0} +%endif +%{!?rsocket:%global rsocket 0} +%endif +%if "%{edition}" == "ent" && %{pgsql_major} > 12 +%{!?lz4:%global lz4 1} +%else +%if %{pgsql_major} > 13 +%{!?lz4:%global lz4 1} +%else +%{!?lz4:%global lz4 0} +%endif +%endif +%if "%{?jit}" == "" +%if %{pgsql_major} > 10 +%global jit 0 +%else +%global jit 0 +%endif +%endif +%global systemd %(if [ -d /run/systemd ] || [ -d "%{unitdir}" ]; then echo 1; else echo 0; fi) +%if 0%{?el6} +%global python3 python3.4 +%else +%global python3 python3 +%endif +%if "%{_vendor}" == "suse" +%global liblz4_devel liblz4-devel +%else +%global liblz4_devel lz4-devel +%endif + +Summary: Postgres Pro %{edition_label} programs and libraries +Name: %{prog_name}-%{edition}-%{pgsql_major} +Version: 15.2 +%if %certification +Release: 1cert1%{?dist} +%else +Release: 1%{?dist} +%endif +License: Postgres Pro %{edition_label} +Group: Applications/Databases +Vendor: Postgres Professional +Url: http://www.postgrespro.ru +%if "%_vendor" == "suse" +BuildArch: %_arch +%endif + +%if 0%{?suse12} || ( 0%{?el7} && ! 0%{?redos73} ) +%define __debug_install_post \ + %{_rpmconfigdir}/find-debuginfo.sh %{?_missing_build_ids_terminate_build:--strict-build-id} %{?_find_debuginfo_opts} "%{_builddir}/%{?buildsubdir}";\ + rm -rf "${RPM_BUILD_ROOT}/usr/src/debug/%{prog_name}%{edition_suffix}-%{version}"; \ + mkdir -p "${RPM_BUILD_ROOT}/usr/src/debug/%{prog_name}%{edition_suffix}-%{version}"; \ +%{nil} +%endif + +Source0: http://repo.postgrespro.ru/pgpro-%{pgsql_major}/src/%{tarname}.tar.bz2 +Source1: pg-wrapper.in +Source3: postgrespro.init.in +Source4: Makefile.regress +Source5: pg_config.h +Source7: ecpg_config.h +Source14: postgrespro.pam +Source17: postgrespro-setup.in +Source18: postgrespro.service.in +Source19: postgrespro-check-db-dir.in +# Example conf files +Source20: small.conf.sample +Source21: medium.conf.sample +Source22: big.conf.sample +# List of pg-probackup files +%if "%{edition}" != "1c" +Source23: backup-src.list +%endif +Source24: buildinfo.txt +Source25: 1c.tune +%if "%{edition}" != "1c" +Source26: std.tune +%endif +%if "%{edition}" == "ent" +Source27: ent.tune +%endif +BuildRequires: gcc perl glibc-devel bison flex +Requires: /sbin/ldconfig +%if %systemd +BuildRequires: systemd-devel +%endif +%if "%{edition}" == "sdm" +BuildRequires: libev-devel +%endif + +%if %plperl +%if %suse +BuildRequires: perl +%else +BuildRequires: perl-ExtUtils-Embed +BuildRequires: perl(ExtUtils::MakeMaker) +%endif +%endif +%if %{plpython} +%if 0%{?el8} || 0%{?redos73} +BuildRequires: python2-devel +%else +BuildRequires: python-devel +%endif +%endif +%if 0%{?el6} || 0%{?rosa73} || 0%{?alteros} +BuildRequires: python34-devel +%else +BuildRequires: python3-devel +%endif + +%if %pltcl +BuildRequires: tcl-devel +%endif +BuildRequires: readline-devel +BuildRequires: zlib-devel >= 1.0.4 +%if %ssl +BuildRequires: openssl-devel +%endif +%if %kerberos +BuildRequires: krb5-devel +BuildRequires: e2fsprogs-devel +%endif + +%if %nls +BuildRequires: gettext >= 0.10.35 +%endif + +%if %xml +BuildRequires: libxml2-devel libxslt-devel +%endif + +%if %pam +BuildRequires: pam-devel +%endif + +%if %uuid +BuildRequires: libuuid-devel +%endif + +%if %ldap +%if %suse +BuildRequires: openldap2-devel +%else +BuildRequires: openldap-devel +%endif +%endif + +%if %zstd +BuildRequires: libzstd-devel +%endif + +%if %lz4 +BuildRequires: %{liblz4_devel} +%endif + +%if %jit +%if %suse +# Suse 15 only +%if %sle_version >= 150200 +BuildRequires: clang7, llvm7-devel, gcc-c++ +%else +BuildRequires: clang5, llvm5-devel, gcc-c++ +%endif +%else +# install centos-release-scl-rh to get this package on centos7 +%if 0%{?el8} || 0%{?el9} +BuildRequires: clang, llvm-devel, gcc-c++ +%else +BuildRequires: llvm-toolset-9.0-clang, llvm9.0-devel, gcc-c++ +%endif +%endif +%endif + +# These are required for -docs subpackage: + +#BuildRequires: docbook-dtds +BuildRequires: libxslt +BuildRequires: libicu-devel + +Requires: %{name}-libs = %{version}-%{release} +Requires: %{name}-server = %{version}-%{release} +Requires: %{name}-contrib = %{version}-%{release} +Requires(post): %{_sbindir}/update-alternatives +Requires(postun): %{_sbindir}/update-alternatives + +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +Provides: postgrespro +Provides: postgrespro%{packageversion} + +Conflicts: postgresql94, postgresql94-server +Conflicts: postgresql, postgresql-server +Conflicts: postgresql10, postgresql10-server +Conflicts: postgresql11, postgresql11-server + +%description +Postgres Pro %{edition_label} is an advanced Object-Relational database +management system (DBMS) that supports almost all SQL constructs +(including transactions, subselects and user-defined types and +functions). The postgrespro package includes the client, server and +contrib programs and libraries. + +%if %suse +%debug_package +%endif + +%package libs +Summary: The shared libraries required for any Postgres Pro %{edition_label} clients +Group: Applications/Databases +Provides: postgrespro-libs +%description libs +The %{name}-libs package provides the essential shared libraries for +any Postgres Pro %{edition_label} client program or interface. +You will need to install this package to use any other Postgres Pro +%{edition_label} package or any clients that need to connect to a +Postgres Pro %{edition_label} server. + +%package client +Summary: Postgres Pro %{edition_label} client programs and libraries +Group: Applications/Databases +Requires: /usr/sbin/useradd +Requires: %{name}-libs = %{version}-%{release} +Provides: postgrespro-client + +%description client +The %{name}-client package includes the client programs and +libraries that you will need to access a Postgres Pro %{edition_label} +DBMS server. These Postgres Pro %{edition_label} client programs are +programs that directly manipulate the internal structure of Postgres Pro +%{edition_label} databases on a Postgres Pro %{edition_label} server. +These client programs can be located on the same machine with the +Postgres Pro %{edition_label} server, or may be on a remote machine which +accesses a Postgres Pro %{edition_label} server over a network connection. + +This package contains the command-line utilities for managing Postgres Pro +%{edition_label} databases on a Postgres Pro %{edition_label} server. + +If you want to manipulate a Postgres Pro %{edition_label} database on a +local or remote Postgres Pro %{edition_label} server, you need this package. + +You also need to install this package if you are installing the +%{name}-server package. + +%package server +Summary: The programs needed to create and run a Postgres Pro %{edition_label} server +Group: Applications/Databases +Requires: /usr/sbin/useradd /sbin/chkconfig +Requires: bash +Requires: coreutils +Requires: %{name}-client = %{version}-%{release} +%if "%{edition}" == "1c" +Requires: %{name}-contrib = %{version}-%{release} +%endif +%if ! %systemd && ! %suse +Requires: /lib/lsb/init-functions +%endif +Provides: postgrespro-server + +%description server +The %{name}-server package includes the programs needed to create and run +a Postgres Pro %{edition_label} server, which will in turn allow you +to create and maintain Postgres Pro %{edition_label} databases. +Postgres Pro %{edition_label} is an advanced Object-Relational database +management system (DBMS) that supports almost all SQL constructs +(including transactions, subselects and user-defined types and functions). +You should install %{name}-server if you want to create and +maintain your own Postgres Pro %{edition_label} databases and/or your +own Postgres Pro %{edition_label} server. You also need to install the +%{name}-client package. + +%package docs +Summary: Extra documentation for Postgres Pro %{edition_label} +Group: Applications/Databases +BuildArch: noarch +Provides: %{prog_name}-docs + +%description docs +The %{name}-docs package includes the XML source for the documentation +as well as the documentation in PDF format and some extra documentation. +Install this package if you want to help with the Postgres Pro %{edition_label} +documentation project, or if you want to generate printed documentation. +This package also includes HTML version of the documentation. + +%package docs-ru +Summary: Russian documentation for Postgres Pro %{edition_label} +Group: Applications/Databases +BuildArch: noarch +Provides: %{prog_name}-docs-ru + +%description docs-ru +The %{name}-docs-ru package includes the XML source for the documentation +as well as the documentation in HTML format and some extra documentation. +This package also includes HTML version of the documentation. +This package includes russion translation of the documentation + +%package contrib +Summary: Contributed source and binaries distributed with Postgres Pro %{edition_label} +Group: Applications/Databases +Requires: %{name}-client = %{version}-%{release} +Requires: %{name}-server = %{version}-%{release} +%if "%edition" == "sdm" +Requires: libev +%endif +Provides: %{prog_name}-contrib + +%description contrib +The %{name}-contrib package contains contributed packages that are +included in the Postgres Pro %{edition_label} distribution. + +This package extends functionality of %{name}-server package. + + +%package devel +Summary: Postgres Pro %{edition_label} development header files and libraries +Group: Development/Libraries +Requires: %{name}-libs = %{version}-%{release} +Requires: zlib-devel, readline-devel, libicu-devel +%if %xml +Requires: libxslt-devel, libxml2-devel, +%endif +%if %ssl +Requires: openssl-devel +%endif +%if %kerberos +Requires: krb5-devel +%endif +%if %pam +Requires: pam-devel +%endif +Requires: readline-devel +%if %lz4 +Requires: %{liblz4_devel} +%endif +%if %zstd +Requires: libzstd-devel +%endif +%if "%edition" == "sdm" +Requires: libev-devel +%endif +Provides: %{prog_name}-devel + +%description devel +The %{name}-devel package contains the header files and libraries +needed to compile C or C++ applications which will directly interact +with a Postgres Pro %{edition_label} database management server and the +ecpg Embedded C Postgres preprocessor. You need to install this package +if you want to develop applications which will interact with a Postgres Pro +%{edition_label} server. + +%if %plperl +%package plperl +Summary: The Perl procedural language for Postgres Pro %{edition_label} +Group: Applications/Databases +Requires: %{name}-server = %{version}-%{release} +Requires: %{name}-contrib = %{version}-%{release} +%if %suse || 0%{?el8} || 0%{?el9} +Requires: perl +%else +Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version)) +%endif +%ifarch ppc ppc64 +BuildRequires: perl-devel +%endif +Provides: %{prog_name}-plperl +Provides: %{prog_name}%{packageversion}-plperl + +%description plperl +Postgres Pro %{edition_label} is an advanced Object-Relational database management system. %{name}-plperl package contains the PL/Perl +language for the backend. +%endif + + +%if %plpython +%if %{plpython2} +%package plpython +Summary: The Python procedural language for Postgres Pro %{edition_label} +Group: Applications/Databases +Requires: %{name}-server = %{version}-%{release} +Requires: %{name}-contrib = %{version}-%{release} +Provides: %{prog_name}-plpython +Provides: %{prog_name}%{packageversion}-plpython + +%description plpython +Postgres Pro %{edition_label} is an advanced Object-Relational database +management system. The %{name}-plpython package contains the +PL/Python language for the backend compiled with version 2 interpreter. +%endif + +%package plpython3 +Summary: The Python3 procedural language for Postgres Pro %{edition_label} +Group: Applications/Databases +Requires: %{name}-server = %{version}-%{release} +Requires: %{name}-contrib = %{version}-%{release} +Provides: %{prog_name}-plpython3 +Provides: %{prog_name}%{packageversion}-plpython3 + +%description plpython3 +Postgres Pro %{edition_label} is an advanced Object-Relational database +management system. The %{name}-plpython3 package contains the +PL/Python language for the backend compiled with Python version 3 interpreter. +%endif + +%if %pltcl +%package pltcl +Summary: The Tcl procedural language for Postgres Pro %{edition_label} +Group: Applications/Databases +Requires: %{name}-server = %{version}-%{release} +Provides: %{prog_name}-pltcl +Provides: %{prog_name}%{packageversion}-pltcl + +%description pltcl +Postgres Pro %{edition_label} is an advanced Object-Relational database +management system. The %{name}-pltcl package contains the PL/Tcl +language for the backend. +%endif + +%if %test +%package test +Summary: The test suite distributed with Postgres Pro %{edition_label} +Group: Applications/Databases +Requires: %{name}-server = %{version}-%{release} +Provides: %{prog_name}-test +Provides: %{prog_name}%{packageversion}-test + +%description test +Postgres Pro %{edition_label} is an advanced Object-Relational database +management system. The %{name}-test package includes the sources and +pre-built binaries of various tests for the Postgres Pro %{edition_label} +database management system, including regression tests and benchmarks. +%endif + +%if "%{edition}" != "1c" +%package backup-src +Summary: Source files from Postgres Pro %{edition_label} to build pg_probackup +Group: Applications/Databases +BuildArch: noarch +Requires: %{name}-devel = %{version}-%{release} + +%description backup-src +pg_probackup is a backup and recovery manager for Postgres Pro %{edition_label} +servers able to do differential and full backup as well as restore a cluster +to a state defined by a given recovery target. It is designed to perform +periodic backups of an existing Postgres Pro %{edition_label} server, combined +with WAL archives to provide a way to recover a server in case of failure of +server because of a reason or another. Its differential backup +facility reduces the amount of data necessary to be taken between +two consecutive backups. + +This package contains few files from PostgresPro source tree which +are required to build pg_probackup. + +Binary of pg_probackup is provided in the pg-probackup-%{edition}-%{pgsql_major} +package. +%endif +%if ("%pgsql_major" == "10" && "%edition" != "1c") || ( "%edition" == "std" && "%pgsql_major" == "11" ) +%package pgprobackup +BuildArch: noarch +Group: Databases +Requires: pg-probackup-%{edition}-%{pgsql_major} +Summary: Transient package to upgrade pg_probackup from previous version + +%description pgprobackup +pg_probackup is a backup and recovery manager for Postgres Pro +%{edition_label} servers able to do. +This is empty transient package with same name as pg_probackup package +has in previous versions of Postgres Pro %{edition_label}. +You can remove it as soon as it was installed, because its only pupose +is to require real pg_probackup-%{edition}-%{pgsql_major} package. + +%endif +%if %jit +%package jit +Summary: Just-in-time compiler for PostgesPro queries +Group: Application/databases +Requires: %{name}-server = %{version}-%{release} + +%description jit +PostgresPro %{edition_label} JIT compiles WHERE conditions of SQL statement +into native machine code using LLVM framework. It might speed up queries +considerable. + +%if %pgsql_major < 12 +It is experimental feature with extra dependiences. +%endif + +%endif + +%prep +%setup -q -n %{tarname} + +%build +CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS +CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS +%if %kerberos +CPPFLAGS="${CPPFLAGS} -I%{_includedir}/et" ; export CPPFLAGS +CFLAGS="${CFLAGS} -I%{_includedir}/et" ; export CFLAGS +%endif + +# Strip out -ffast-math from CFLAGS.... +CFLAGS=`echo $CFLAGS|xargs -n 1|grep -v ffast-math|xargs -n 100` + +%if %jit +%if "%{edition}" == "ent" && %{pgsql_major} >= 12 +BITCODE_CFLAGS=-I$(echo /usr/lib/gcc/*/*/include|awk '{print $1}') +export BITCODE_CFLAGS +%endif +%if 0%{?el8} +if [ ! -x /usr/bin/llvm-config ] && [ -x /usr/bin/llvm-config-64 ]; then + +LLVM_CONFIG=/usr/bin/llvm-config-64 +export LLVM_CONFIG +fi +%endif +%if 0%{?el7} +. /opt/rh/llvm-toolset-9.0/enable +CLANG=clang-9 +export CLANG +LLVM_CONFIG=/usr/bin/llvm-config-9.0-64 +export LLVM_CONFIG +%endif +%endif +%if 0%{?redos} +echo "Redos %{redos_rel} detected redos73 set to %{redos73}" +%endif +%if 0%{?el8} || 0%{?redos73} +export PYTHON=/usr/bin/python2 +%endif +[ -z "$USE_PGXS" ] || unset USE_PGXS +export LIBNAME=%{_lib} +%if 0%{?debug} +export CFLAGS=-O0 +%endif +PYTHON=/usr/bin/%{python3} ./configure \ + --prefix=%{pgbaseinstdir} \ + --bindir=%bindir \ + --includedir=%includedir \ + --libdir=%libdir \ + --with-libs=%_libdir \ + --sysconfdir=%sysconfdir \ + --datadir=%datadir \ + --enable-nls \ + --enable-thread-safety \ + --mandir=%mandir \ + --docdir=%docdir \ + --htmldir=%docdir \ + --enable-debug \ +%if 0%{?debug} + --enable-cassert \ +%endif +%if %certification + --enable-svt5 \ +%endif +%if %systemd + --with-systemd \ +%endif +%if %plperl + --with-perl \ +%endif +%if %plpython + --with-python \ +%endif +%if %pltcl + --with-tcl \ + --with-tclconfig=%{_libdir} \ +%endif +%if %ssl + --with-openssl \ +%endif +%if %pam + --with-pam \ +%endif +%if %kerberos + --with-gssapi \ + --with-includes=%{kerbdir}/include \ + --with-libraries=%{kerbdir}/%{_lib} \ +%endif +%if %nls + --enable-nls \ +%endif +%if !%intdatetimes + --disable-integer-datetimes \ +%endif +%if %disablepgfts + --disable-thread-safety \ +%endif +%if %uuid + --with-uuid=e2fs \ +%endif +%if %xml + --with-libxml \ + --with-libxslt \ +%endif +%if %ldap + --with-ldap \ +%endif +%if %zstd + --with-zstd \ +%endif +%if %lz4 + --with-lz4 \ +%endif +%if %rsocket + --with-rsocket \ +%endif +%if %jit + --with-llvm \ +%endif + --with-system-tzdata=%{_datadir}/zoneinfo \ + --with-readline \ + --with-icu + +%if %{plpython2} +mkdir py2 +(cd py2 +PYTHON=/usr/bin/python2 ../configure \ + --prefix=%{pgbaseinstdir} \ + --bindir=%bindir \ + --includedir=%includedir \ + --libdir=%libdir \ + --with-libs=%_libdir \ + --sysconfdir=%sysconfdir \ + --datadir=%datadir \ + --enable-nls \ + --enable-thread-safety \ + --mandir=%mandir \ + --docdir=%docdir \ + --htmldir=%docdir \ +%if %certification + --enable-svt5 \ +%endif +%if %systemd + --with-systemd \ +%endif +%if %plperl + --with-perl \ +%endif + --with-python \ +%if %pltcl + --with-tcl \ + --with-tclconfig=%{_libdir} \ +%endif +%if %ssl + --with-openssl \ +%endif +%if %pam + --with-pam \ +%endif +%if %kerberos + --with-gssapi \ + --with-includes=%{kerbdir}/include \ + --with-libraries=%{kerbdir}/%{_lib} \ +%endif +%if %nls + --enable-nls \ +%endif +%if !%intdatetimes + --disable-integer-datetimes \ +%endif +%if %disablepgfts + --disable-thread-safety \ +%endif +%if %uuid + --with-uuid=e2fs \ +%endif +%if %xml + --with-libxml \ + --with-libxslt \ +%endif +%if %ldap + --with-ldap \ +%endif +%if %zstd + --with-zstd \ +%endif +%if %lz4 + --with-lz4 \ +%endif +%if %rsocket + --with-rsocket \ +%endif +%if %jit + --with-llvm \ +%endif + --with-system-tzdata=%{_datadir}/zoneinfo \ + --with-icu +make %{?_smp_mflags} -C src/pl/plpython all +for ext in contrib/*_plpython; do +make %{?_smp_mflags} -C $ext all +done +) +%endif +make %{?_smp_mflags} all +make %{?_smp_mflags} -C contrib all +%if %uuid +make %{?_smp_mflags} -C contrib/uuid-ossp all +%endif + + +# Have to hack makefile to put correct path into tutorial scripts +sed "s|C=\`pwd\`;|C=%{pgbaseinstdir}/lib/tutorial;|" < src/tutorial/Makefile > src/tutorial/GNUmakefile +make %{?_smp_mflags} -C src/tutorial NO_PGXS=1 all +rm -f src/tutorial/GNUmakefile src/tutorial/.gitignore + +%if %runselftest + pushd src/test/regress + make all + cp ../../../contrib/spi/refint.so . + cp ../../../contrib/spi/autoinc.so . + make MAX_CONNECTIONS=5 check + make clean + popd + pushd src/pl + make MAX_CONNECTIONS=5 check + popd + pushd contrib + make MAX_CONNECTIONS=5 check + popd +%endif + +%if %test + pushd src/test/regress + make all + popd +%endif + +%install +[ -z "$USE_PGXS" ] || unset USE_PGXS +rm -rf %{buildroot} + +make DESTDIR=%{buildroot} install +%if %{plpython2} +for dir in py2/src/pl/plpython py2/contrib/*_plpython; do + make -C $dir DESTDIR=%{buildroot} install +done +%endif + +install -c -m 755 %SOURCE25 %{buildroot}%{datadir} +%if "%{edition}" != "1c" +install -c -m 755 %SOURCE26 %{buildroot}%{datadir} +%endif +%if "%{edition}" == "ent" +install -c -m 755 %SOURCE27 %{buildroot}%{datadir} +%endif +%if "%{pgsql_major}" == "10" +sed -i '/max_parallel_maintenance_workers/d' %{buildroot}%{datadir}/*.tune +%endif +%if %certification +# Reset security confs + sed -i -e '/bin\/ecpg/d' \ + -e '/plperl\.so/d' \ + -e '/pltcl\.so/d' \ + -e '/plpython.\.so/d' \ + %{buildroot}%{datadir}/security/system.conf.sample +for conf in user catalog system; do + cp %{buildroot}%{datadir}/security/${conf}.conf.sample %{buildroot}%{datadir}/security/${conf}.conf +done +%endif +sleep 1 +touch contrib-flag +sleep 2 # otherwise we have installed files that are not newer than flag + +mkdir -p %{buildroot}%{pgbaseinstdir}/share/extension/ +make -C contrib DESTDIR=%{buildroot} install +%if %uuid +make -C contrib/uuid-ossp DESTDIR=%{buildroot} install +%endif + +%if ! %{plpython2} +# removing plpython3 extensions +rm -rf %{buildroot}%{datadir}/extension/hstore_plpython2* +rm -rf %{buildroot}%{datadir}/extension/ltree_plpython2* +rm -rf %{buildroot}%{datadir}/extension/jsonb_plpython2* +%endif +# Exclude from contrib filelist everything related to the pg_probackup +# because it is packaged separately from contrib and all header files, +# because they belongs to -devel +find %buildroot -type f -cnewer contrib-flag -printf "/%%P\n" |grep -v -e '/doc/' |grep -v -e 'pg_probackup'|grep -v -e '\.bc$' |grep -v -e '\.h$' > contrib.lst +# man pages for contrib utils: +sed -n 's!/bin/\(.*\)$!/share/man/man1/\1.1.gz!p' < contrib.lst >contrib.man.lst +sed -n 's!/bin/\(.*\)$!/share/man/ru/man1/\1.1.gz!p' < contrib.lst >>contrib.man.lst +cat contrib.man.lst >>contrib.lst + +# Split plperl and plpython-based extensions into appoprate packages +grep plperl contrib.lst > pg_plperl.lst +sed -i '/plperl/d' contrib.lst +%if %plpython2 +grep plpython contrib.lst |grep -v python3 > pg_plpython.lst ||true +%else +rm -f %{buildroot}%{datadir}/extension/*plpython2u* +rm -f %{buildroot}%{datadir}/extension/*plpythonu* +%endif + + +sed -i '/plpython/d' contrib.lst +# rm contrib-flag +#make -C doc/src/xml DESTDIR=%{buildroot} install + +# multilib header hack; note pg_config.h is installed in two places! +# we only apply this to known Red Hat multilib arches, per bug #177564 +case `uname -i` in + i386 | x86_64 | ppc | ppc64 | s390 | s390x) + mv %{buildroot}%{pgbaseinstdir}/include/pg_config.h %{buildroot}%{pgbaseinstdir}/include/pg_config_`uname -i`.h + install -m 644 %{SOURCE5} %{buildroot}%{pgbaseinstdir}/include/ + mv %{buildroot}%{pgbaseinstdir}/include/server/pg_config.h %{buildroot}%{pgbaseinstdir}/include/server/pg_config_`uname -i`.h + install -m 644 %{SOURCE5} %{buildroot}%{pgbaseinstdir}/include/server/ + mv %{buildroot}%{pgbaseinstdir}/include/ecpg_config.h %{buildroot}%{pgbaseinstdir}/include/ecpg_config_`uname -i`.h + install -m 644 %{SOURCE7} %{buildroot}%{pgbaseinstdir}/include/ + ;; + *) + ;; +esac + +%if %jit +# Remove with_llvm from PGXS Makefile global to allow to built +# extensions without LLVM/CLANG installed if you don't need JIT + sed -i -e 's/^with_llvm[ ]*=.*$/with_llvm ?= no/' \ + %buildroot%{pgbaseinstdir}/lib/pgxs/src/Makefile.global +%endif + +install -m 755 %{SOURCE1} %buildroot%bindir/pg-wrapper +sed -i 's,@BINDIR@,%bindir,' %buildroot%bindir/pg-wrapper +sed -i 's,@MANDIR@,%mandir,' %buildroot%bindir/pg-wrapper +sed -i 's,@VERSION@,%pgsql_major,' %buildroot%bindir/pg-wrapper + +install -m 755 %{SOURCE17} %buildroot%bindir/pg-setup +sed -i 's,@PROGNAME@,%prog_name,' %buildroot%bindir/pg-setup +sed -i 's,@BINDIR@,%bindir,g' %buildroot%bindir/pg-setup +sed -i 's,@MANDIR@,%mandir,' %buildroot%bindir/pg-setup +sed -i 's,@VERSION@,%pgsql_major,' %buildroot%bindir/pg-setup +sed -i 's,@EDITION@,%edition,' %buildroot%bindir/pg-setup +sed -i 's,@PREFIX@,%pgbaseinstdir,' %buildroot%bindir/pg-setup +install -m 755 %{SOURCE19} %buildroot%bindir/check-db-dir +sed -i 's,@BINDIR@,%bindir,' %buildroot%bindir/check-db-dir +sed -i 's,@VERSION@,%pgsql_major,' %buildroot%bindir/check-db-dir +sed -i 's,@EDITION@,%edition,' %buildroot%bindir/check-db-dir + +%if %systemd +install -d %buildroot%unitdir +install -m 644 %{SOURCE18} %buildroot%unitdir/%{prog_name}-%{edition}-%{pgsql_major}.service +sed -i 's,@ARCH@,%_arch,g' %buildroot%unitdir/%{prog_name}-%{edition}-%{pgsql_major}.service +sed -i 's,@BINDIR@,%bindir,g' %buildroot%unitdir/%{prog_name}-%{edition}-%{pgsql_major}.service +sed -i 's,@LIBDIR@,%libdir,' %buildroot%unitdir/%{prog_name}-%{edition}-%{pgsql_major}.service +sed -i 's,@VERSION@,%pgsql_major,' %buildroot%unitdir/%{prog_name}-%{edition}-%{pgsql_major}.service +sed -i 's,@EDITION@,%edition,' %buildroot%unitdir/%{prog_name}-%{edition}-%{pgsql_major}.service +%if 0%{?debug} +sed -i '/Type=notify/a \ +LimitCORE=infinity' %buildroot%unitdir/%{prog_name}-%{edition}-%{pgsql_major}.service +%endif +%else +install -p -m755 -D %{SOURCE3} %buildroot%initddir/%{prog_name}-%{edition}-%{pgsql_major} +sed -i 's,@ARCH@,%_arch,g' %buildroot%initddir/%{prog_name}-%{edition}-%{pgsql_major} +sed -i 's,@BINDIR@,%bindir,g' %buildroot%initddir/%{prog_name}-%{edition}-%{pgsql_major} +sed -i 's,@LIBDIR@,%libdir,' %buildroot%initddir/%{prog_name}-%{edition}-%{pgsql_major} +sed -i 's,@VERSION@,%pgsql_major,' %buildroot%initddir/%{prog_name}-%{edition}-%{pgsql_major} +sed -i 's,@EDITION@,%edition,' %buildroot%initddir/%{prog_name}-%{edition}-%{pgsql_major} +%endif + +echo %{pgbaseinstdir}/lib/ > %{prog_name}-%{edition}-%{pgsql_major}-libs.conf + +%if %pam +install -d %{buildroot}/etc/pam.d +install -m 644 %{SOURCE14} %{buildroot}/etc/pam.d/%{prog_name}%{packageversion} +%endif + +# PGDATA needs removal of group and world permissions due to pg_pwd hole. +install -d -m 700 %{buildroot}%{pgdir}/data + +# backups of data go here... +install -d -m 700 %{buildroot}%{pgdir}/backups + +# Create the multiple postmaster startup directory +install -d -m 700 %{buildroot}/etc/sysconfig/%{short_prog_name}/%{pgsql_major} + +# Install linker conf file under postgrespro installation directory. +# We will install the latest version via alternatives. +install -d -m 755 %{buildroot}%{pgbaseinstdir}/share/ +install -m 700 %{prog_name}-%{edition}-%{pgsql_major}-libs.conf %{buildroot}%{pgbaseinstdir}/share/ + +%if %test +# tests. There are many files included here that are unnecessary, +# but include them anyway for completeness. We replace the original +# Makefiles, however. +mkdir -p %{buildroot}%{pgbaseinstdir}/lib/test +cp -a src/test/regress %{buildroot}%{pgbaseinstdir}/lib/test +install -m 0755 contrib/spi/refint.so %{buildroot}%{pgbaseinstdir}/lib/test/regress +install -m 0755 contrib/spi/autoinc.so %{buildroot}%{pgbaseinstdir}/lib/test/regress +pushd %{buildroot}%{pgbaseinstdir}/lib/test/regress +strip *.so +rm -f GNUmakefile Makefile *.o +chmod 0755 pg_regress regress.so +popd +cp %{SOURCE4} %{buildroot}%{pgbaseinstdir}/lib/test/regress/Makefile +chmod 0644 %{buildroot}%{pgbaseinstdir}/lib/test/regress/Makefile +%endif + +# Fix some more documentation +#cp %{SOURCE6} README.rpm-dist + +# make datadir +mkdir -p %{buildroot}%{datadir} +cp %{SOURCE20} %{SOURCE21} %{SOURCE22} %{buildroot}%{datadir}/ # conf examples +cp COPYRIGHT %{buildroot}%{docdir}/ +%if "%{edition}" != "1c" +cp COPYRIGHT.ru %{buildroot}%{docdir}/ +%endif +#cp doc/bug.template %{buildroot}%{docdir}/ + +mkdir -p %{buildroot}%{docdir} +cp doc/buildinfo.txt %{buildroot}%{docdir}/ +cat %{SOURCE24} >> %{buildroot}%{docdir}/buildinfo.txt +rm -rf %{buildroot}%{docdir}/contrib + +# html en +mkdir -p %{buildroot}%{docdir}/html +cp doc/src/%{docformat}/html/*.html %{buildroot}%{docdir}/html/ +cp doc/src/%{docformat}/html/*.css %{buildroot}%{docdir}/html/ +PICTURES="$(ls doc/src/%{docformat}/html/*.png doc/src/%{docformat}/html/*.svg 2>/dev/null||:)" +if [ -n "$PICTURES" ]; then +cp $PICTURES %{buildroot}%{docdir}/html/ +fi +# html ru +mkdir -p %{buildroot}%{docdir}/html-ru +cp doc/src/%{docformat}/ru/html/* %{buildroot}%{docdir}/html-ru/ +%if "%{edition}" == "sdm" +mkdir -p %{buildroot}%{docdir}/shardman/html/ +cp contrib/shardman/doc/html/* %{buildroot}%{docdir}/shardman/html/ +%endif + + +# man 1 3 7 +mkdir -p %{buildroot}%{pgbaseinstdir}/share/man/ +cp -r doc/src/%{docformat}/man1 %{buildroot}%{pgbaseinstdir}/share/man/ +cp -r doc/src/%{docformat}/man3 %{buildroot}%{pgbaseinstdir}/share/man/ +cp -r doc/src/%{docformat}/man7 %{buildroot}%{pgbaseinstdir}/share/man/ +mkdir -p %{buildroot}%{pgbaseinstdir}/share/man/ru/ +cp -r doc/src/%{docformat}/ru/man1 %{buildroot}%{pgbaseinstdir}/share/man/ru/ +cp -r doc/src/%{docformat}/ru/man3 %{buildroot}%{pgbaseinstdir}/share/man/ru/ +cp -r doc/src/%{docformat}/ru/man7 %{buildroot}%{pgbaseinstdir}/share/man/ru/ +%if %certification +touch %{buildroot}%{pgbaseinstdir}/share/man/ru/man1/pg_integrity_check.1 +%endif + +rm -rf %{buildroot}%{_docdir}/pgsql + +# manuals for utilities which are packaged separately +for i in pg_filedump pg_repack pg_probackup pgbadger mamonsu pgpro_controldata; do + rm -f %{buildroot}%{pgbaseinstdir}/share/man/man1/$i.1* + rm -f %{buildroot}%{pgbaseinstdir}/share/man/ru/man1/$i.1* +done +%if ! 0%{?certification} + rm -f %{buildroot}%{pgbaseinstdir}/share/man/man1/pg_integrity_check.1* + rm -f %{buildroot}%{pgbaseinstdir}/share/man/ru/man1/pg_integrity_check.1* +%endif +# pg_probackup - remove it whille it present in source tree +rm -f %{buildroot}%{pgbaseinstdir}/bin/pg_probackup +# Compressing man pages +for n in 1 3 7; do + gzip %{buildroot}%{pgbaseinstdir}/share/man/man${n}/*.${n} + gzip %{buildroot}%{pgbaseinstdir}/share/man/ru/man${n}/*.${n} +done + +# clear 1C readme +rm -rf %{buildroot}%{pgbaseinstdir}/doc/contrib/README.online_analyze +rm -rf %{buildroot}%{pgbaseinstdir}/doc/contrib/README.plantuner +rm -rf %{buildroot}%{pgbaseinstdir}/doc/extension/README.fasttrun +rm -rf %{buildroot}%{pgbaseinstdir}/doc/extension/README.fulleq +rm -rf %{buildroot}%{pgbaseinstdir}/doc/extension/README.mchar + +cp -r src/tutorial %{buildroot}%{pgbaseinstdir}/doc +rm -rf %{buildroot}%{pgbaseinstdir}/doc/tutorial/*.so %{buildroot}%{pgbaseinstdir}/doc/tutorial/*.o + +# initialize file lists +cp /dev/null main.lst +cp /dev/null libs.lst +cp /dev/null server.lst +cp /dev/null devel.lst +# At this stage plperl.lst and plpython.lst already filled with useful files +#cp /dev/null plperl.lst +#cp /dev/null plpython.lst +cp /dev/null pltcl.lst +%if "%{edition}" != "1c" +cp /dev/null backup-src.lst + +#generate filelist for backup-src package and install its files by the way + +grep -v '^#' %{SOURCE23} | while read NAME; do + NAME=$(echo ${NAME}|sed 's#/sgml/#/%{docformat}/#') + if [ -e ${NAME} ]; then + echo %{pgbaseinstdir}/src/backup/${NAME} >> backup-src.lst + DEST="%{buildroot}%{pgbaseinstdir}/src/backup/`dirname $NAME`" + install -d -m 755 ${DEST} + install -c -m 644 ${NAME} ${DEST} + fi +done +%endif + +# Postgresql 10 make install doesn't install errcodes.txt. We do it ourselves +# for compatibility with newer major versions +%if %{pgsql_major} == 10 +install -c -m 644 src/backend/utils/errcodes.txt %{buildroot}%{pgbaseinstdir}/share +%endif +%if %nls +%find_lang ecpg-%{pgsql_major} +%find_lang ecpglib6-%{pgsql_major} +%find_lang initdb-%{pgsql_major} +%find_lang libpq5-%{pgsql_major} +%find_lang pg_basebackup-%{pgsql_major} +%if %{pgsql_major} >= 13 +%find_lang pg_verifybackup-%{pgsql_major} +%endif +%if %{pgsql_major} >= 14 +%find_lang pg_amcheck-%{pgsql_major} +%endif +%find_lang pg_config-%{pgsql_major} +%find_lang pg_controldata-%{pgsql_major} +%find_lang pg_ctl-%{pgsql_major} +%find_lang pg_dump-%{pgsql_major} +%find_lang pg_resetwal-%{pgsql_major} +%find_lang pg_rewind-%{pgsql_major} +%find_lang pgscripts-%{pgsql_major} +%find_lang pg_waldump-%{pgsql_major} +%find_lang pg_upgrade-%{pgsql_major} +%find_lang pg_archivecleanup-%{pgsql_major} +%find_lang pg_test_fsync-%{pgsql_major} +%find_lang pg_test_timing-%{pgsql_major} +%if %pgsql_major == 11 +%find_lang pg_verify_checksums-%{pgsql_major} +%endif +%if %pgsql_major >= 12 +%find_lang pg_checksums-%{pgsql_major} +%endif +%if %plperl +%find_lang plperl-%{pgsql_major} +cat plperl-%{pgsql_major}.lang >> pg_plperl.lst +%endif +%find_lang plpgsql-%{pgsql_major} +%if %plpython +%find_lang plpython-%{pgsql_major} +cat plpython-%{pgsql_major}.lang >> pg_plpython.lst +%endif +%if %pltcl +%find_lang pltcl-%{pgsql_major} +cat pltcl-%{pgsql_major}.lang > pg_pltcl.lst +%endif +%find_lang postgres-%{pgsql_major} +%find_lang psql-%{pgsql_major} +%endif + +cat libpq5-%{pgsql_major}.lang ecpglib6-%{pgsql_major}.lang> pg_libpq5.lst +cat pg_config-%{pgsql_major}.lang ecpg-%{pgsql_major}.lang > pg_devel.lst +cat psql-%{pgsql_major}.lang pg_dump-%{pgsql_major}.lang pg_basebackup-%{pgsql_major}.lang pgscripts-%{pgsql_major}.lang > pg_client.lst +cat postgres-%{pgsql_major}.lang initdb-%{pgsql_major}.lang pg_ctl-%{pgsql_major}.lang pg_resetwal-%{pgsql_major}.lang pg_rewind-%{pgsql_major}.lang pg_waldump-%{pgsql_major}.lang pg_upgrade-%{pgsql_major}.lang pg_controldata-%{pgsql_major}.lang plpgsql-%{pgsql_major}.lang pg_archivecleanup-%{pgsql_major}.lang pg_test_fsync-%{pgsql_major}.lang pg_test_timing-%{pgsql_major}.lang > pg_server.lst +%if %pgsql_major == 11 +cat pg_verify_checksums-%{pgsql_major}.lang >> pg_server.lst +%endif +%if %pgsql_major >= 12 +cat pg_checksums-%{pgsql_major}.lang >> pg_server.lst +%endif +%if %pgsql_major >= 13 +cat pg_verifybackup-%{pgsql_major}.lang >> pg_client.lst +%endif +%if %pgsql_major >= 14 +cat pg_amcheck-%{pgsql_major}.lang >> pg_client.lst +%endif + +%pre server +groupadd -g 26 -o -r postgres >/dev/null 2>&1 || : +useradd -M -g postgres -o -r -d /var/lib/pgsql -s /bin/bash \ + -c "Postgres Pro Server" -u 26 postgres >/dev/null 2>&1 || : +[ -d /var/lib/pgsql ] || mkdir -p /var/lib/pgsql +chown postgres:postgres /var/lib/pgsql +chmod 700 /var/lib/pgsql +%post server +/sbin/ldconfig + +# Prepare home +[ -d ~postgres ] || mkdir -p ~postgres +chown postgres:postgres ~postgres +chmod 700 ~postgres +# Create /etc/default/postgrespro-@EDITION@-@VERSION@ +# If we are upgrading from previous minor release where this file +# didn't exist and we have database under default PATH +if [ -f %{pgdatadir}/PG_VERSION -a ! -f "/etc/default/%{name}" ]; then + echo "PGDATA=%{pgdatadir}" > /etc/default/%{name} +fi + +%if %certification +%{pgbaseinstdir}/bin/pg_integrity_check -o -s +%endif + +if [ -f /etc/default/%{name} ]; then + SCTL=/bin/systemctl + if [ -x $SCTL ] && $SCTL 1>/dev/null 2>/dev/null; then + $SCTL daemon-reload + fi + . /etc/default/%{name} + if [ ! "$ENABLE_ONLINE_UPGRADE" = "1" ]; then + %{pgbaseinstdir}/bin/pg-setup service condrestart + fi +fi +%preun server +if [ $1 = 0 ] ; then # Uninstall + %{pgbaseinstdir}/bin/pg-setup service stop 2>/dev/null || true + %{pgbaseinstdir}/bin/pg-setup service disable 2>/dev/null || true +fi + +%postun server +/sbin/ldconfig + +%if %plperl +%post -p /sbin/ldconfig plperl +%postun -p /sbin/ldconfig plperl +%endif + +%if %plpython2 +%post -p /sbin/ldconfig plpython +%postun -p /sbin/ldconfig plpython +%endif + +%if %pltcl +%post -p /sbin/ldconfig pltcl +%postun -p /sbin/ldconfig pltcl +%endif + +%if %test +%post test +chown -R postgres:postgres %{datadir}/pgsql/test >/dev/null 2>&1 || : +%endif + +%post + +if [ "$1" -eq 1 ]; then +# Do all this things only on first install. Skip them on upgrade +# Create alternatives entries for common binaries and man files +%{pgbaseinstdir}/bin/pg-wrapper links update + +if [ ! -f %{pgdatadir}/PG_VERSION ]; then + free_port=`%{pgbaseinstdir}/bin/pg-setup find-free-port` + %{pgbaseinstdir}/bin/pg-setup initdb + if [ $free_port != 5432 ]; then + echo "Set %{edition}-%{pgsql_major} PGPORT to $free_port" + %{pgbaseinstdir}/bin/pg-setup set-server-port $free_port + fi +elif [ ! -f /etc/default/postgrespro-%{edition}-%{pgsql_major} ]; then + echo "PGDATA=%{pgdatadir}" >/etc/default/postgrespro-%{edition}-%{pgsql_major} +fi +%{pgbaseinstdir}/bin/pg-setup service enable +%{pgbaseinstdir}/bin/pg-setup service start +fi +%preun +if [ "$1" -eq 0 ] # Un-installation +then + %{pgbaseinstdir}/bin/pg-wrapper links remove +fi + +%clean +rm -rf %{buildroot} + +# FILES section. +%files +%defattr(-,root,root) +%dir %pgbaseinstdir +%dir %bindir + +%files client -f pg_client.lst +%defattr(-,root,root) +%dir %{pgbaseinstdir} +%dir %bindir +%dir %{datadir} +%dir %datadir/locale +%dir %datadir/locale/* +%dir %datadir/locale/*/LC_MESSAGES +%dir %mandir +%dir %mandir/man1 +%dir %mandir/man7 +%dir %mandir/ru +%dir %mandir/ru/man1 +%dir %mandir/ru/man7 +%dir %docdir +%{docdir}/buildinfo.txt +%{docdir}/COPYRIGHT +%if "%{edition}" != "1c" +%{docdir}/COPYRIGHT.ru +%endif +%{pgbaseinstdir}/bin/pg-wrapper +%{pgbaseinstdir}/bin/clusterdb +%{pgbaseinstdir}/bin/createdb +%{pgbaseinstdir}/bin/createuser +%{pgbaseinstdir}/bin/dropdb +%{pgbaseinstdir}/bin/dropuser +%{pgbaseinstdir}/bin/pgbench +%{pgbaseinstdir}/bin/pg_basebackup +%{pgbaseinstdir}/bin/pg_dump +%{pgbaseinstdir}/bin/pg_dumpall +%{pgbaseinstdir}/bin/pg_isready +%{pgbaseinstdir}/bin/pg_receivewal +%{pgbaseinstdir}/bin/pg_restore +%{pgbaseinstdir}/bin/psql +%{pgbaseinstdir}/bin/reindexdb +%{pgbaseinstdir}/bin/vacuumdb +%{pgbaseinstdir}/bin/pg_recvlogical +%if %{pgsql_major} >= 13 +%{pgbaseinstdir}/bin/pg_verifybackup +%endif +%if %{pgsql_major} >= 14 +%{pgbaseinstdir}/bin/pg_amcheck +%endif +%{pgbaseinstdir}/share/psqlrc.sample +%{pgbaseinstdir}/share/man/man1/clusterdb.* +%{pgbaseinstdir}/share/man/man1/createdb.* +%{pgbaseinstdir}/share/man/man1/createuser.* +%{pgbaseinstdir}/share/man/man1/dropdb.* +%{pgbaseinstdir}/share/man/man1/dropuser.* +%{pgbaseinstdir}/share/man/man1/pg_basebackup.* +%{pgbaseinstdir}/share/man/man1/pg_dump.* +%{pgbaseinstdir}/share/man/man1/pg_dumpall.* +%{pgbaseinstdir}/share/man/man1/pg_isready.* +%{pgbaseinstdir}/share/man/man1/pg_receivewal.* +%{pgbaseinstdir}/share/man/man1/pg_restore.* +%{pgbaseinstdir}/share/man/man1/pg-wrapper.* +%{pgbaseinstdir}/share/man/man1/pgbench.* +%{pgbaseinstdir}/share/man/man1/psql.* +%{pgbaseinstdir}/share/man/man1/reindexdb.* +%{pgbaseinstdir}/share/man/man1/vacuumdb.* +%{pgbaseinstdir}/share/man/man1/pg_recvlogical.* +%if %{pgsql_major} >= 13 +%{pgbaseinstdir}/share/man/man1/pg_verifybackup.* +%endif +%if %{pgsql_major} >= 14 +%{pgbaseinstdir}/share/man/man1/pg_amcheck.* +%endif +%{pgbaseinstdir}/share/man/ru/man1/clusterdb.* +%{pgbaseinstdir}/share/man/ru/man1/createdb.* +%{pgbaseinstdir}/share/man/ru/man1/createuser.* +%{pgbaseinstdir}/share/man/ru/man1/dropdb.* +%{pgbaseinstdir}/share/man/ru/man1/dropuser.* +%{pgbaseinstdir}/share/man/ru/man1/pg_basebackup.* +%{pgbaseinstdir}/share/man/ru/man1/pg_dump.* +%{pgbaseinstdir}/share/man/ru/man1/pg_dumpall.* +%{pgbaseinstdir}/share/man/ru/man1/pg_isready.* +%{pgbaseinstdir}/share/man/ru/man1/pg_receivewal.* +%{pgbaseinstdir}/share/man/ru/man1/pg_restore.* +%{pgbaseinstdir}/share/man/ru/man1/pg-wrapper.* +%{pgbaseinstdir}/share/man/ru/man1/pgbench.* +%{pgbaseinstdir}/share/man/ru/man1/psql.* +%{pgbaseinstdir}/share/man/ru/man1/reindexdb.* +%{pgbaseinstdir}/share/man/ru/man1/vacuumdb.* +%{pgbaseinstdir}/share/man/ru/man1/pg_recvlogical.* +%if %{pgsql_major} >= 13 +%{pgbaseinstdir}/share/man/ru/man1/pg_verifybackup.* +%endif +%if %{pgsql_major} >= 14 +%{pgbaseinstdir}/share/man/ru/man1/pg_amcheck.* +%endif +%{pgbaseinstdir}/share/man/man7/* +%{pgbaseinstdir}/share/man/ru/man7/* + +%files docs +%defattr(-,root,root) +%dir %{pgbaseinstdir} +%dir %{docdir} +%dir %{docdir}/html +%dir %{docdir}/tutorial +%dir %{docdir}/extension +%if "%{edition}" == "sdm" +%dir %{docdir}/shardman +%dir %{docdir}/shardman/html +%{docdir}/shardman/html/* +%endif +%{docdir}/html/* +%{docdir}/extension/*.example +%{docdir}/tutorial/* + +%files docs-ru +%defattr(-,root,root) +%dir %{pgbaseinstdir} +%dir %{docdir} +%dir %{docdir}/html-ru +%{docdir}/html-ru/* + +%files contrib -f contrib.lst +%defattr(-,root,root) +%dir %{pgbaseinstdir} +%dir %{datadir} +%dir %{datadir}/extension +%dir %{datadir}/tsearch_data +%dir %{pgbaseinstdir}/lib + +%files libs -f pg_libpq5.lst +%defattr(-,root,root) +%dir %{pgbaseinstdir} +%dir %{datadir} +%dir %datadir/locale +%dir %datadir/locale/* +%dir %datadir/locale/*/LC_MESSAGES +%dir %{pgbaseinstdir}/lib +%{pgbaseinstdir}/lib/libpq.so.* +%{pgbaseinstdir}/lib/libecpg.so* +%{pgbaseinstdir}/lib/libpgtypes.so.* +%{pgbaseinstdir}/lib/libecpg_compat.so.* +%{pgbaseinstdir}/lib/libpqwalreceiver.so +%{pgbaseinstdir}/share/%{prog_name}-%{edition}-%{pgsql_major}-libs.conf + +%files server -f pg_server.lst +%defattr(-,root,root) +%dir %{pgbaseinstdir} +%dir %{datadir} +%dir %datadir/locale +%dir %datadir/locale/* +%dir %datadir/locale/*/LC_MESSAGES +%dir %mandir +%dir %mandir/man1 +%dir %mandir/ru +%dir %mandir/ru/man1 +%dir %bindir +%dir %datadir/timezonesets +%dir %datadir/tsearch_data +%{pgbaseinstdir}/bin/pg-setup +%{pgbaseinstdir}/bin/check-db-dir +%if %systemd +%unitdir/%{prog_name}-%{edition}-%{pgsql_major}.service +%else +%{initddir}/%{prog_name}-%{edition}-%{pgsql_major} +%endif +%if %pam +%config(noreplace) /etc/pam.d/%{prog_name}%{packageversion} +%endif +%attr (755,root,root) %dir /etc/sysconfig/%{short_prog_name} +%{pgbaseinstdir}/bin/initdb +%{pgbaseinstdir}/bin/pg_archivecleanup +%{pgbaseinstdir}/bin/pg_controldata +%{pgbaseinstdir}/bin/pg_ctl +%{pgbaseinstdir}/bin/pg_resetwal +%{pgbaseinstdir}/bin/postgres +%{pgbaseinstdir}/bin/postmaster +%{pgbaseinstdir}/bin/pg_test_fsync +%{pgbaseinstdir}/bin/pg_test_timing +%{pgbaseinstdir}/bin/pg_rewind +%{pgbaseinstdir}/bin/pg_upgrade +%if %pgsql_major == 11 +%{pgbaseinstdir}/bin/pg_verify_checksums +%endif +%if %pgsql_major >= 12 +%{pgbaseinstdir}/bin/pg_checksums +%endif +%{pgbaseinstdir}/bin/pg_waldump +%{pgbaseinstdir}/share/man/man1/initdb.* +%{pgbaseinstdir}/share/man/man1/pg_controldata.* +%{pgbaseinstdir}/share/man/man1/pg_archivecleanup.* +%{pgbaseinstdir}/share/man/man1/pg_ctl.* +%{pgbaseinstdir}/share/man/man1/pg_resetwal.* +%{pgbaseinstdir}/share/man/man1/pg_test_fsync.* +%{pgbaseinstdir}/share/man/man1/pg_test_timing.* +%if %pgsql_major == 11 +%{pgbaseinstdir}/share/man/man1/pg_verify_checksums.* +%endif +%if %pgsql_major >= 12 +%{pgbaseinstdir}/share/man/man1/pg_checksums.* +%endif +%{pgbaseinstdir}/share/man/man1/pg-setup.* +%{pgbaseinstdir}/share/man/man1/postgres.* +%{pgbaseinstdir}/share/man/man1/postmaster.* +%{pgbaseinstdir}/share/man/man1/pg_rewind.* +%{pgbaseinstdir}/share/man/man1/pg_upgrade.* +%{pgbaseinstdir}/share/man/man1/pg_waldump.* +%{pgbaseinstdir}/share/man/ru/man1/initdb.* +%{pgbaseinstdir}/share/man/ru/man1/pg_archivecleanup.* +%{pgbaseinstdir}/share/man/ru/man1/pg_controldata.* +%{pgbaseinstdir}/share/man/ru/man1/pg_ctl.* +%{pgbaseinstdir}/share/man/ru/man1/pg_resetwal.* +%{pgbaseinstdir}/share/man/ru/man1/pg_test_fsync.* +%{pgbaseinstdir}/share/man/ru/man1/pg_test_timing.* +%if %pgsql_major == 11 +%{pgbaseinstdir}/share/man/ru/man1/pg_verify_checksums.* +%endif +%if %pgsql_major >= 12 +%{pgbaseinstdir}/share/man/ru/man1/pg_checksums.* +%endif +%{pgbaseinstdir}/share/man/ru/man1/pg-setup.* +%{pgbaseinstdir}/share/man/ru/man1/postgres.* +%{pgbaseinstdir}/share/man/ru/man1/postmaster.* +%{pgbaseinstdir}/share/man/ru/man1/pg_rewind.* +%{pgbaseinstdir}/share/man/ru/man1/pg_upgrade.* +%{pgbaseinstdir}/share/man/ru/man1/pg_waldump.* +%{pgbaseinstdir}/share/postgres.bki +%if %{pgsql_major} < 13 +%{pgbaseinstdir}/share/postgres.description +%{pgbaseinstdir}/share/postgres.shdescription +%endif +%{pgbaseinstdir}/share/system_*.sql +%{pgbaseinstdir}/share/*.conf.sample +%{pgbaseinstdir}/share/*.tune +%{pgbaseinstdir}/share/timezonesets/* +%{pgbaseinstdir}/share/tsearch_data/*.affix +%{pgbaseinstdir}/share/tsearch_data/*.dict +%{pgbaseinstdir}/share/tsearch_data/*.ths +%{pgbaseinstdir}/share/tsearch_data/*.rules +%{pgbaseinstdir}/share/tsearch_data/*.stop +%{pgbaseinstdir}/share/tsearch_data/*.syn +%{pgbaseinstdir}/lib/dict_int.so +%{pgbaseinstdir}/lib/dict_snowball.so +%{pgbaseinstdir}/lib/dict_xsyn.so +%{pgbaseinstdir}/lib/euc2004_sjis2004.so +%{pgbaseinstdir}/lib/plpgsql.so +%{pgbaseinstdir}/lib/pgoutput.so +%dir %{pgbaseinstdir}/share/extension +%{pgbaseinstdir}/share/extension/plpgsql* +%dir %{pgbaseinstdir}/lib +%attr(700,postgres,postgres) %dir /var/lib/%{short_prog_name} +%attr(700,postgres,postgres) %dir /var/lib/%{short_prog_name}/%{edition}-%{pgsql_major} +%attr(700,postgres,postgres) %dir /var/lib/%{short_prog_name}/%{edition}-%{pgsql_major}/data +%attr(700,postgres,postgres) %dir /var/lib/%{short_prog_name}/%{edition}-%{pgsql_major}/backups +%{pgbaseinstdir}/lib/*_and_*.so +%if %pgsql_major <= 11 +%{pgbaseinstdir}/share/conversion_create.sql +%endif +%{pgbaseinstdir}/share/information_schema.sql +%{pgbaseinstdir}/share/snowball_create.sql +%{pgbaseinstdir}/share/sql_features.txt +%if %certification +%{pgbaseinstdir}/bin/pg_integrity_check +%dir %{pgbaseinstdir}/share/security +%{pgbaseinstdir}/share/security/*.conf +%{pgbaseinstdir}/share/security/*.conf.sample +%{pgbaseinstdir}/share/man/man1/pg_integrity_check.* +%{pgbaseinstdir}/share/man/ru/man1/pg_integrity_check.* +%datadir/locale/*/LC_MESSAGES/pg_integrity_check*.mo +%endif + +%files devel -f pg_devel.lst +%defattr(-,root,root) +%dir %{pgbaseinstdir} +%dir %{pgbaseinstdir}/include +%{pgbaseinstdir}/include/* +%dir %bindir +%dir %libdir +%dir %libdir/pgxs +%dir %libdir/pkgconfig +%dir %datadir +%dir %mandir +%dir %mandir/ru +%dir %mandir/man1 +%dir %mandir/man3 +%dir %mandir/ru/man1 +%dir %mandir/ru/man3 +%{pgbaseinstdir}/bin/pg_config +%{pgbaseinstdir}/bin/ecpg +%{pgbaseinstdir}/lib/libpq.so +%{pgbaseinstdir}/lib/libecpg.so +%{pgbaseinstdir}/lib/libpq.a +%{pgbaseinstdir}/lib/libpgcommon.a +%if %{pgsql_major} >= 12 +%{pgbaseinstdir}/lib/libpgcommon_shlib.a +%{pgbaseinstdir}/lib/libpgport_shlib.a +%endif +%{pgbaseinstdir}/lib/libecpg.a +%{pgbaseinstdir}/lib/libecpg_compat.so +%{pgbaseinstdir}/lib/libecpg_compat.a +%{pgbaseinstdir}/lib/libpgport.a +%{pgbaseinstdir}/lib/libpgtypes.so +%{pgbaseinstdir}/lib/libpgtypes.a +%{pgbaseinstdir}/lib/libpgfeutils.a +%{pgbaseinstdir}/lib/pgxs/* +%{pgbaseinstdir}/lib/pkgconfig/* +%{pgbaseinstdir}/share/man/man1/ecpg.* +%{pgbaseinstdir}/share/man/ru/man1/ecpg.* +%{pgbaseinstdir}/share/man/man1/pg_config.* +%{pgbaseinstdir}/share/man/ru/man1/pg_config.* +%{pgbaseinstdir}/share/man/man3/* +%{pgbaseinstdir}/share/man/ru/man3/* +%{datadir}/errcodes.txt + +%if %plperl +%files plperl -f pg_plperl.lst +%defattr(-,root,root) +%{pgbaseinstdir}/lib/plperl.so +%{pgbaseinstdir}/share/extension/plperl* +%endif + +%if %pltcl +%files pltcl -f pg_pltcl.lst +%defattr(-,root,root) +%{pgbaseinstdir}/lib/pltcl.so +%{pgbaseinstdir}/share/extension/pltcl* +%endif + +%if %{plpython2} +%files plpython +%defattr(-,root,root) +%{pgbaseinstdir}/lib/plpython2.so +%{pgbaseinstdir}/lib/*_plpython2.so +%{pgbaseinstdir}/share/extension/plpython2u* +%{pgbaseinstdir}/share/extension/plpythonu* +%{pgbaseinstdir}/share/extension/*_plpython2u* +%{pgbaseinstdir}/share/extension/*_plpythonu* +%{pgbaseinstdir}/share/locale/*/LC_MESSAGES/plpython*.mo +%endif + +%if %plpython +%files plpython3 +%defattr(-,root,root) +%{pgbaseinstdir}/lib/plpython3.so +%{pgbaseinstdir}/lib/*_plpython3.so +%{pgbaseinstdir}/share/extension/plpython3* +%{pgbaseinstdir}/share/extension/*_plpython3* +%if ! %{plpython2} +%{pgbaseinstdir}/share/locale/*/LC_MESSAGES/plpython*.mo +%endif +%endif + +%if %test +%files test +%defattr(-,postgres,postgres) +%attr(-,postgres,postgres) %{pgbaseinstdir}/lib/test/* +%attr(-,postgres,postgres) %dir %{pgbaseinstdir}/lib/test +%endif + +%if "%{edition}" != "1c" +%files backup-src -f backup-src.lst +%defattr(-,root,root) +%dir %{pgbaseinstdir}/src +%dir %{pgbaseinstdir}/src/backup +%dir %{pgbaseinstdir}/src/backup/src +%dir %{pgbaseinstdir}/src/backup/src/backend +%dir %{pgbaseinstdir}/src/backup/src/backend/access +%dir %{pgbaseinstdir}/src/backup/src/backend/access/transam +%dir %{pgbaseinstdir}/src/backup/src/backend/utils +%dir %{pgbaseinstdir}/src/backup/src/backend/utils/hash +%dir %{pgbaseinstdir}/src/backup/src/bin +%dir %{pgbaseinstdir}/src/backup/src/bin/pg_rewind +%dir %{pgbaseinstdir}/src/backup/src/bin/pg_basebackup +%dir %{pgbaseinstdir}/src/backup/doc +%dir %{pgbaseinstdir}/src/backup/doc/src +%dir %{pgbaseinstdir}/src/backup/doc/src/%docformat +%dir %{pgbaseinstdir}/src/backup/doc/src/%docformat/ru +%dir %{pgbaseinstdir}/src/backup/doc/src/%docformat/ru/man1 +%dir %{pgbaseinstdir}/src/backup/doc/src/%docformat/man1 + +%endif +%if ( "%pgsql_major" == "10" && "%edition" != "1c" ) || ( "%edition" == "std" && "%pgsql_major" == "11" ) +%files pgprobackup +%defattr(-,root,root) + +%endif +%if %jit +%files jit +%defattr(-,root,root) +%dir %{pgbaseinstdir}/lib +%{pgbaseinstdir}/lib/bitcode +%{pgbaseinstdir}/lib/llvmjit.so +%{pgbaseinstdir}/lib/llvmjit_types.bc +%endif +%changelog +* Wed Nov 06 2019 Victor Wagner 10.11.1-1 +- Remove generation of backup-src package for edition 1c + +* Mon Oct 07 2019 Dmitry Maslyuk 11.5.4-1 +- Change to PostgresPro Enterprise 11.5.4-1 version + +* Fri Sep 13 2019 Victor Wagner 11.5.3-1 +- Change to PostgresPro Enterprise 11.5.3-1 version + +* Thu Aug 22 2019 Victor Wagner 11.5.2-1 +- Change to PostgresPro Enterprise 11.5.2-1 version + +* Wed Aug 07 2019 Victor Wagner 11.5.1-1 +- Change to PostgresPro Enterprise 11.5.1-1 version + +* Fri Jul 19 2019 Victor Wagner 11.4.2-1 +- Change to PostgresPro Enterprise 11.4.2-1 version + +* Tue Jun 18 2019 Dmitry Maslyuk 11.4.1-1 +- Change to PostgresPro Enterprise 11.4.1-1 version + +* Wed May 08 2019 Dmitry Maslyuk 11.3.1-1 +- Change to PostgresPro Enterprise 11.3.1-1 version + +* Fri Feb 15 2019 Dmitry Maslyuk 11.2.1-1 +- Change to PostgresPro Enterprise 11.2.1-1 version + +* Wed Feb 13 2019 Dmitry Maslyuk 11.2.1-1 +- Change to PostgresPro 11.2.1-1 version + +* Wed Feb 06 2019 Victor Wagner +- remove pgprobackup package and make backup-src instead. + +* Tue Nov 06 2018 Victor Wagner 11.1.1-1 +- Change to PostgresPro 11.1.1-1 version + +* Thu Oct 18 2018 Victor Wagner 11.0.1-1 +- Change to PostgresPro 11 +- Support for two versions of python + +* Fri Aug 10 2018 Dmitry Maslyuk 10.5.1-1 +- Change to PostgresPro 10.5.1-1 version + +* Tue May 08 2018 Dmitry Maslyuk 10.4.1-1 +- Change to PostgresPro 10.4.1-1 version + +* Thu Mar 15 2018 Victor Wagner 10.3.2-1 +- Change to PostgresPro Standard 10.3.2 version + +* Tue Feb 27 2018 Victor Wagner 10.3.1-1 +- Change to PostgresPro Standard 10.3.1 version + +* Tue Feb 06 2018 Dmitry Maslyuk 10.2.1-1 +- Change to PostgresPro Standard 10.2.1-1 version + +* Thu Nov 09 2017 Dmitry Maslyuk 10.1.1-1 +- Change to PostgresPro 10.1.1-1 version + +* Tue Oct 03 2017 Dmitry Maslyuk 10.0.1-1 +- Change to Postgres Pro Standard 10.0.1-1 version + +* Mon Sep 04 2017 Dmitry Maslyuk 9.6.5.2-1 +- Change to PostgresPro 9.6.5.2-1 version + +* Mon Aug 28 2017 Dmitry Maslyuk 9.6.5.1-1 +- Change to PostgresPro 9.6.5.1-1 version + +* Fri Aug 18 2017 Dmitry Maslyuk 9.6.4.2-1 +- Change to PostgresPro 9.6.4.2-1 version + +* Thu Aug 17 2017 Dmitry Maslyuk 9.6.4.1-2 +- Change to PostgresPro 9.6.4.1-2 version + +* Tue Aug 08 2017 Dmitry Maslyuk 9.6.4.1-1 +- Change to PostgresPro 9.6.4.1-1 version + +* Fri Jul 07 2017 Dmitry Maslyuk 9.6.3.2-1 +- Change to PostgresPro 9.6.3.2-1 version +- Fixed potential data corruption during freeze + +* Wed May 10 2017 Dmitry Maslyuk 9.6.3.1-1 +- Change to PostgresPro 9.6.3.1-1 version + +* Fri Mar 24 2017 Dmitry Maslyuk 9.6.2.2-1 +- Change to PostgresPro 9.6.2.2-1 version + +* Wed Jan 25 2017 Dmitry Maslyuk 9.6.1.3-1 +- Change to PostgresPro 9.6.1.3-1 version + +* Fri Dec 02 2016 Dmitry Maslyuk 9.6.1.2-1 +- Change to PostgresPro 9.6.1.2-1 version + +* Wed Nov 09 2016 Dmitry Maslyuk 9.6.1.1-1 +- Change to PostgresPro 9.6.1.1-1 version + +* Fri Oct 28 2016 Dmitry Maslyuk 9.6.0.1-4 +- Change to PostgresPro 9.6.0.1-4 version + +* Tue Sep 27 2016 Dmitry Maslyuk 9.6.0.1-1 +- Change to PostgresPro 9.6.0.1-1 version + +* Mon Sep 19 2016 Dmitry Maslyuk 9.6.rc1.1-1 +- Change to PostgresPro 9.6.rc1.1-1 version + +* Mon Sep 19 2016 Dmitry Maslyuk 9.6.rc.1.1-1 +- Change to PostgresPro 9.6.rc.1.1-1 version + +* Fri Sep 02 2016 Dmitry Maslyuk 9.6.rc.1-1 +- Change to PostgresPro 9.6.rc.1-1 version + +* Wed Aug 24 2016 Dmitry Maslyuk 9.6.beta.4-1 +- Change to PostgresPro 9.6.beta.4-1 version + +* Thu Jul 21 2016 Dmitry Maslyuk 9.6beta3-1 +- Change to PostgresPro 9.6beta3-1 version + +* Tue Jun 28 2016 Dmitry Maslyuk 9.5.3.3-1 +- Change to PostgresPro 9.5.3.3-1 version + +* Fri Jun 24 2016 Dmitry Maslyuk 9.5.3.2-1 +- Change to PostgresPro 9.5.3.2-1 version +- PGPRO pg_dump backward compatibility with PostgreSQL +- Update pg_arman with ptrack +- PGPRO pathman stability fixes +- Documentation fixes +- Do checks before pgpro_upgrade calling +- Fix assorted missing infrastructure for ON CONFLICT +- Fix broken error handling in parallel pg_dump/pg_restore +- Fix PageAddItem BRIN bug +- And other upstream fixes + +* Wed May 18 2016 Victor Wagner 9.5.3.1-2 +- Fixes of pgpro_update call +- Changed numbering scheme to conform with other distributives + +* Tue May 10 2016 Victor Wagner 9.5.3.1 +- Updated to PostgresPro 9.5.3.1 + +* Mon Apr 18 2016 Dmitry Maslyuk 9.5.2.2 +- Updated to PostgresPro 9.5.2.2 +- Added russian docs +- Added pgpro upgrade system + +* Mon Mar 28 2016 Victor Wagner 9.5.2.1 +- Updated to PostgresPro 9.5.2.1 + +* Mon Feb 29 2016 Alexey Slaykovsky 9.5.1.2 +- Updated to 9.5.1.2 + +* Tue Feb 9 2016 Dmitry Vasilyev 9.5.1.1 +- Merge with upstream 9.5.1 + +* Tue Jan 12 2016 Alexey Slaykovsky - 9.5.0.pro +- Update to 9.5.beta1.pro certified + +* Fri Nov 13 2015 Alexey Slaykovsky - 9.5.beta1.pro +- Update to 9.5.beta1.pro certified + +* Tue Nov 10 2015 Devrim Gündüz - 9.5beta2-1PGDG +- Update to 9.5beta2 + +* Tue Nov 3 2015 Devrim Gündüz - 9.5beta1-2PGDG +- Specify/fix --docdir and --htmldir in configure line. + +* Tue Oct 6 2015 Jeff Frost - 9.5.beta1-1PGDG +- Update to 9.5beta1 + +* Tue Sep 1 2015 Devrim Gündüz - 9.5alpha2-1PGDG +- Initial cut for 9.5 alpha2 +- Move pg_archivecleanup, pg_test_fsync, pg_test_timing, pg_xlogdump, + pgbench, and pg_upgrade to main package. +- Remove dummy_seclabel, test_shm_mq, test_parser, and worker_spi. + +* Thu Jun 11 2015 Devrim Gündüz - 9.4.4-1PGDG +- Update to 9.4.4, per changes described at: + http://www.postgresql.org/docs/9.4/static/release-9-4-4.html + +* Thu Jun 4 2015 Devrim Gündüz - 9.4.3-1PGDG +- Update to 9.4.3, per changes described at: + http://www.postgresql.org/docs/9.4/static/release-9-4-3.html + +* Wed May 20 2015 Devrim Gündüz - 9.4.2-1PGDG +- Update to 9.4.2, per changes described at: + http://www.postgresql.org/docs/9.4/static/release-9-4-2.html + +* Tue Feb 3 2015 Devrim Gündüz - 9.4.1-1PGDG +- Update to 9.4.1, per changes described at: + http://www.postgresql.org/docs/9.4/static/release-9-4-1.html +- Improve .bash_profile, and let users specify their own + environmental settings by sourcing an external file, called + ~/.pgsql_profile. Per request from various users, and final + suggestion from Martin Gudmundsson. + +* Mon Jan 19 2015 Devrim Gündüz - 9.4.0-2PGDG +- Fix PREVMAJORVERSION in init script, per Tomonari Katsumata. + +* Wed Dec 17 2014 Devrim Gündüz - 9.4.0-1PGDG +- Update to 9.4.0 + +* Tue Nov 18 2014 Devrim Gündüz - 9.4rc1-1PGDG +- Update to 9.4 rc1 + +* Wed Oct 8 2014 Devrim Gündüz - 9.4beta3-1PGDG +- Update to 9.4 beta 3 + +* Mon Sep 01 2014 Craig Ringer - 9.4beta2-2PGDG +- Use libuuid from e2fsprogs instead of ossp-uuid to remove EPEL dependency +- Remove obsolete /var/log/pgsql +- Remove Provides: entry for libpq.so (RPM generates one) + +* Tue Jul 22 2014 Devrim Gündüz - 9.4beta2-1PGDG +- Update to 9.4 beta 2 + +* Thu May 15 2014 Jeff Frost - 9.4beta1-1PGDG +- Update to 9.4 beta 1 +- Fix permissions of postgresql-94-libs.conf, per Christoph Berg. + +* Tue Mar 18 2014 Devrim GÜNDÜZ - 9.3.4-1PGDG +- Update to 9.3.4, per changes described at: + http://www.postgresql.org/docs/9.3/static/release-9-3-4.html + +* Tue Feb 18 2014 Devrim GÜNDÜZ - 9.3.3-1PGDG +- Update to 9.3.3, per changes described at: + http://www.postgresql.org/docs/9.3/static/release-9-3-3.html + +* Thu Dec 12 2013 Devrim GÜNDÜZ - 9.3.2-2PGDG +- Fix builds when uuid support is disabled, by adding missing conditional. +- Add process name to the status() call in init script. + Patch from Darrin Smart + +* Wed Dec 04 2013 Devrim GÜNDÜZ - 9.3.2-1PGDG +- Update to 9.3.2, per changes described at: + http://www.postgresql.org/docs/9.3/static/release-9-3-2.html + +* Tue Oct 8 2013 Devrim GÜNDÜZ - 9.3.1-1PGDG +- Update to 9.3.1, per changes described at: + http://www.postgresql.org/docs/9.3/static/release-9-3-1.html +- Fix issues with init script, per http://wiki.pgrpms.org/ticket/136. + +* Tue Sep 3 2013 Devrim GÜNDÜZ - 9.3.0-1PGDG +- Update to 9.3.0 + +* Tue Aug 20 2013 Devrim GÜNDÜZ - 9.3rc1-1PGDG +- Update to 9.3 RC1 + +* Wed Jun 26 2013 Jeff Frost - 9.3beta2-1PGDG +- Update to 9.3 beta 2 + +* Tue May 14 2013 Devrim GÜNDÜZ - 9.3beta1-4PGDG +- Revert #90. Per a report in pgsql-bugs mailing list. + +* Mon May 13 2013 Devrim GÜNDÜZ - 9.3beta1-3PGDG +- Fix paths in init script. Per repor from Vibhor Kumar. + +* Sun May 12 2013 Devrim GÜNDÜZ - 9.3beta1-2PGDG +- Support separated xlog directory at initdb. Per suggestion from + Magnus Hagander. Fixes #90. +- Remove hardcoded script names in init script. Fixes #102. +- Add support for pg_ctl promote. Per suggestion from Magnus Hagander. + Fixes #93. +- Set log_line_prefix in default config file to %m. Per suggestion + from Magnus. Fixes #91. + +* Tue May 07 2013 Jeff Frost - 9.3beta1-1PGDG +- Initial cut for 9.3 beta 1 + +* Wed Apr 17 2013 Devrim GÜNDÜZ - 9.2.4-3PGDG +- Fix pid file name in init script, so that it is more suitable for multiple + postmasters. Per suggestion from Andrew Dunstan. Fixes #92. + +* Thu Apr 11 2013 Devrim GÜNDÜZ - 9.2.4-2PGDG +- Add pg_basebackup to $PATH, per #75. + +* Tue Apr 02 2013 Jeff Frost - 9.2.4-1PGDG +- Update to 9.2.4, per changes described at: + http://www.postgresql.org/docs/9.2/static/release-9-2-4.html + which also includes fixes for CVE-2013-1899, CVE-2013-1900, and + CVE-2013-1901. + +* Fri Feb 8 2013 Devrim GÜNDÜZ - 9.2.3-2PGDG +- Fix bug in new installations, that prevents ld.so.conf.d file + to be installed. + +* Wed Feb 6 2013 Devrim GÜNDÜZ - 9.2.3-1PGDG +- Update to 9.2.3, per changes described at: + http://www.postgresql.org/docs/9.2/static/release-9-2-3.html +- Fix -libs issue while installing 9.1+ in parallel. Per various + bug reports. Install ld.so.conf.d file with -libs subpackage. +- Move $pidfile and $lockfile definitions before sysconfig call, + so that they can be included in sysconfig file. + +* Thu Dec 6 2012 Devrim GÜNDÜZ - 9.2.2-1PGDG +- Update to 9.2.2, per changes described at: + http://www.postgresql.org/docs/9.2/static/release-9-2-2.html + +* Thu Sep 20 2012 Devrim GÜNDÜZ - 9.2.1-1PGDG +- Update to 9.2.1, per changes described at: + http://www.postgresql.org/docs/9.2/static/release-9-2-1.html +- Add new functionality: Upgrade from previous version. + Usage: service postgresql-9.2 upgrade +- Fix version number in initdb warning message, per Jose Pedro Oliveira. + +* Thu Sep 6 2012 Devrim GÜNDÜZ - 9.2.0-1PGDG +- Update to 9.2.0 +- Split .control files in appropriate packages. This is a late port + from 9.1 branch. With this patch, pls can be created w/o installing + -contrib subpackage. +- Re-enable -test subpackage, removed accidentally. + +* Tue Aug 28 2012 Devrim GÜNDÜZ - 9.2rc1-2 +- Install linker conf file with alternatives, so that the latest + version will always be used. Fixes #77. + +* Fri Aug 24 2012 Devrim GÜNDÜZ - 9.2rc1-1 +- Update to 9.2 RC1 + +* Thu Aug 16 2012 Devrim GÜNDÜZ - 9.2beta4-1 +- Update to 9.2 beta4, which also includes fixes for CVE-2012-3489 + and CVE-2012-3488. + +* Mon Aug 6 2012 Devrim GÜNDÜZ - 9.2beta3-1 +- Update to 9.2 beta3 + +* Wed Jun 6 2012 Devrim GÜNDÜZ - 9.2beta2-1 +- Update to 9.2 beta2, which also includes fixes for CVE-2012-2143, + CVE-2012-2655. + +* Fri May 18 2012 Devrim GÜNDÜZ - 9.2beta1-1 +- Initial cut for 9.2 Beta 1 diff --git a/small.conf.sample b/small.conf.sample new file mode 100644 index 0000000..37a1a27 --- /dev/null +++ b/small.conf.sample @@ -0,0 +1,18 @@ +# Version: 9.6 +# OS Type: linux +# DB Type: oltp +# Total Memory (RAM): 4 GB +# Number of Connections: 20 + +max_connections = 20 +shared_buffers = 1GB +effective_cache_size = 3GB +work_mem = 52428kB +maintenance_work_mem = 256MB +min_wal_size = 2GB +max_wal_size = 4GB +checkpoint_completion_target = 0.9 +wal_buffers = 16MB +default_statistics_target = 100 + +