Imported from SRPM

This commit is contained in:
Sergey Zhemoitel 2014-09-18 14:59:27 +04:00
commit 67630f1d8c
19 changed files with 12916 additions and 0 deletions

3
.abf.yml Normal file
View file

@ -0,0 +1,3 @@
sources:
postgresql-9.3-A4.pdf: 3465825cc5e89429314fcdccfc26a788d57a53e2
postgresql-9.3.4.tar.bz2: a5b4a63339c26849e8e9b7645436c976e4b40f50

9120
1c_FULL_93-0.23.2 Normal file

File diff suppressed because it is too large Load diff

67
Makefile.regress Normal file
View file

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

351
README.rpm-dist Normal file
View file

@ -0,0 +1,351 @@
README.rpm-dist
-----------------------------------------------------------------------------
Version 9.3, for the PostgreSQL 9.3 RPM set.
Devrim Gündüz <devrim@gunduz.org>
-----------------------------------------------------------------------------
Contents:
1.) Introduction and QuickStart
2.) Upgrading an installation
3.) PostgreSQL RPM packages and rationale
4.) Starting multiple postmasters
5.) Regression Testing
6.) Starting postmaster automatically on startup
7.) Grand Unified Configuration(GUC) File
8.) Logging set up
9.) Rebuilding from the source RPM
10.) Contrib files
11.) Further Information Resource
INTRODUCTION
-----------------------------------------------------------------------------
This document exists to explain the layout of the RPMs for PostgreSQL, to
describe various RPM specifics, and to document special features found
in the RPMset.
This document is written to be applicable to version 9.3 of PostgreSQL,
which is the current version of the RPMs as of this writing. More to the
point, versions prior to 9.3 are not documented here.
Official PostgreSQL Global Development Group RPMs carry a 'PGDG after the
release number. Other RPMsets as distributed with Linux distributions may
have a different release number and initials.
If you want to stay up-to-date on the PostgreSQL core itself, you may
want to use PGDG set, instead of the binaries supplied by distribution.
These RPMs do not support any sort of major version upgrading process
other than that documented in the regular documentation. That is, you
must dump, upgrade,initdb, and restore your data if you are
performing a major version update. This is not needed for minor version
updates.
QUICKSTART (note that this requires postgresql93-server installed)
-----------------------------------------------------------------------------
For a fresh installation, you will need to initialize the cluster first. Run:
/usr/pgsql-9.3/bin/postgresql93-setup initdb
as root, and it will prepare a new database cluster for you. Then you will
need to start PostgreSQL. Again as root, run:
systemctl start postgresql-9.3.service
This command will start a postmaster that willl listen on localhost and Unix
socket 5432 only. Edit /var/lib/pgsql/9.3/data/postgresql.conf and pg_hba.conf
if you want to allow remote access -- see the section on Grand Unified
Configuration.
You will probably also want to do
systemctl enable postgresql-9.3.service
so that the postmaster is automatically started during future reboots.
The file /var/lib/pgsql/9.3/.bash_profile is packaged to help with the
setting of environment variables. You may edit this file, and it won't be
overwritten during an upgrade. However, enhancements and bugfixes may
be added to this file, so be sure to check .bash_profile.rpmnew after
upgrading.
The user 'postgres' is created during installation of the server subpackage.
This user by default is UID and GID 26. The user has the default shell set to
bash, and the home directory set to /var/lib/pgsql. This user also has no
default password. If you want to be able to su to it from a non-root account
or login as 'postgres' you will need to set a password using passwd.
In the default installation, only postgres user is allowed to access to
the database server, because initdb in the RPMs pick up "peer" auth
method in the RPMs.
All the binaries are installed under /usr/pgsql-9.3/bin. However, the
tools that are compatible with the previous releases are symlinked under
/usr/bin directory. Please note that RPMs are using alternatives method
in here, so whenever a newer major version is installed, symlinks will
point to the new version. Here is the current list of the binaries that
are under $PATH:
- clusterdb
- createdb
- createlang
- createuser
- dropdb
- droplang
- dropuser
- pg_dump
- pg_dumpall
- pg_restore
- psql
- reindexdb
You may want to add /usr/pgsql-9.3/bin to your $PATH variable in
/etc/profile, if you want to use them easily. However, please note that
this may lead to some unintentional side effects, so be careful.
UPGRADING AN INSTALLATION
-----------------------------------------------------------------------------
For a minor-version upgrade (such as 9.3.1 to 9.3.2), just install the
new RPMs; there's usually nothing more to it than that. Upgrading
across a major release of PostgreSQL (for example, from 9.2.x to 9.3.x)
requires more effort.
If you are upgrading across more than one major release of PostgreSQL
(for example, from 9.1.x to 9.3.x), you will need to follow the "traditional"
dump and reload process to bring your data into the new version. That is:
*before* upgrading, run pg_dumpall to extract all your data into a SQL file.
Shut down the old postmaster, upgrade to the new version RPMs, initdb,
and run the dump file through psql to restore your data.
In 9.1+, the RPMs also support in-place upgrade from th immediately
previous major release. Currently, you can upgrade in-place
from 9.2.x to 9.3.x. Just run:
$ /usr/pgsql-9.3/bin/postgresql93-setup upgrade
Please note that 9.2 and 9.3 contrib RPMs needs to be installed for this
feature to work.
POSTGRESQL RPM PACKAGES AND RATIONALE.
-----------------------------------------------------------------------------
PostgreSQL is split up into multiple packages so that users can 'pick and
choose' what pieces are needed, and what dependencies are required.
The RPMset is packaged in the following subpackages:
postgresql93: Key clients and libraries, and documentation
postgresql93-server: Server executables and data files
postgresql93-devel: Development libraries and include files
postgresql93-test: The regression tests and associated files
postgresql93-libs: Client shared libraries
postgresql93-docs: Extra documentation, such as the tutorial files
postgresql93-contrib: The contrib source tree, as well as selected binaries
postgresql93-plperl: PL/Perl procedural language
postgresql93-plpython: PL/Python procedural language
postgresql93-pltcl: PL/Tcl procedural language
postgresql93-jdbc, postgresql93-python, postgresql93-tcl and postgresql93-odbc have
been splitted into seperate (s)rpms.
You have to install postgresql and postgresql93-libs to do anything.
postgresql93-server is needed unless you only plan to use the clients to work
with a remote PostgreSQL server. The others are optional.
postgresql93-python package includes PyGreSQL, and Pgtcl is distributed
via postgresql93-tcl package.
RPM FILE LOCATIONS.
-----------------------------------------------------------------------------
To be in compliance with the Linux FHS, the PostgreSQL RPMs install files in
a manner not consistent with most of the PostgreSQL documentation. According
to the standard PostgreSQL documentation, PostgreSQL is installed under the
directory /usr/local/pgsql, with executables, source, and data existing in
various subdirectories.
Different distributions have different ideas of some of these file locations.
In particular, the documentation directory can be /usr/doc, /usr/doc/packages,
/usr/share/doc, /usr/share/doc/packages, or some other similar path.
However, the Red Hat / Scientific Linux ( CentOS / Fedora RPM's install
the files like this:
Executables: /usr/bin and /usr/pgsql-9.3/bin
Libraries: /usr/pgsql-9.3/lib
Documentation: /usr/pgsql-9.3/doc
Contrib documentation: /usr/pgsql-9.3/doc
Source: not installed
Data: /var/lib/pgsql/9.3/data
Backup area: /var/lib/pgsql/9.3/backups
Templates: /usr/pgsql-9.3/share
Procedural Languages: /usr/pgsql-9.3/lib
Development Headers: /usr/pgsql-9.3/include
Other shared data: /usr/pgsql-9.3/share
Regression tests: /usr/pgsql-9.3/lib/test
While it may seem gratuitous to place these files in different locations, the
FHS requires it -- distributions should not ever touch /usr/local. It may
also seem like more work to keep track of where everything is -- but, that's
the beauty of RPM -- you don't have to keep track of the files, RPM does it
for you.
These RPMs are designed to be LSB-compliant -- if you find this not to be the
case, please let us know by way of the pgsql-pkg-yum@postgresql.org
mailing list.
-------------------------------------------------------------------------------
MULTIPLE POSTMASTERS (For the same PostgreSQL version)
-------------------------------------------------------------------------------
The postgresql-server RPM contains an 'initscript' that is used to start the
postmaster. The current version of this script has logic to be able to start
multiple postmasters, with different data areas, listening on different ports,
etc. To use this functionality requires root access.
As an example, let us create a secondary postmaster called, creatively enough,
'secondary'. Here are the steps:
1.) create a hard link in /etc/rc.d/init.d (or equivalent location)
to postgresql-9.3 named 'secondary-9.3' : ln postgresql secondary Pick
a name not already used in /etc/rc.d/init.d!
2.) create a file in /etc/sysconfig/pgsql named secondary. This file is
a shell script -- typically you would define PGDATA, PGPORT, and PGOPTS
here. Since $PGDATA/postgresql.conf will override many of these
settings, except PGDATA, you might be surprised on startup.
3.) create the target PGDATA.
4.) Initdb the targe PGDATA as documented in the main documentation.
Automatic initdb may or may not work for you, so a manual one is
preferred. This must be done as user 'postgres'
5.) Edit postgresql.conf to change the port, address, tcpip settings, etc.
6.) Start the postmaster with 'service secondary-9.3 start'.
Note that there may be problems with the standard symlink -- consider this
support experimental at this point in time.
When doing a major-version upgrade of a secondary postmaster, mention the
service name in the postgresql-setup command, for example 'postgresql-setup
upgrade secondary'. This will let postgresql-setup find the correct data
directory from the service file.
REGRESSION TESTING
-------------------------------------------------------------------------------
If you install the postgresql-test RPM then you can run the PostgreSQL
regression tests. These tests stress your database installation and produce
results that give you assurances that the installation is complete, and that
your database machine is up to the task.
To run the regression tests under the RPM installation, make sure that the
postmaster has been started (if not, su to root and do "systemctl start
postgresql-9.3.service"), cd to /usr/pgsql-9.3/lib/test/regress, su to
postgres, and execute "make check". This command will start the
regression tests and will both show the results to the screen and store
the results in the file regress.out.
If any tests fail, see the file regression.diffs in that directory for details,
and read the "Regression Tests" section of the PostgreSQL documentation to
find out whether the differences are actually significant. If you need help
interpreting the results, contact the pgsql-general list at
postgresql.org.
After testing, say "make clean" to remove the files generated by the test
script.
STARTING POSTMASTER AUTOMATICALLY AT SYSTEM STARTUP
-------------------------------------------------------------------------------
Fedora / Red Hat / CentOS use the systemd package to manage server startup.
A systemd unit file for PostgreSQL is provided in the server package, as
/lib/systemd/system/postgresql-9.3.service. To start the postmaster manually,
as root run
systemctl start postgresql-9.3.service
To shut the postmaster down,
systemctl stop postgresql-9.3.service
These two commands only change the postmaster's current status. If you
want the postmaster to be started automatically during future system startups,
run
systemctl enable postgresql-9.3.service
To undo that again,
systemctl disable postgresql-9.3.service
See "man systemctl" for other possible subcommands.
GRAND UNIFIED CONFIGURATION (GUC) FILE
-------------------------------------------------------------------------------
The PostgreSQL server has many tunable parameters -- the file
/var/lib/pgsql/9.3/data/postgresql.conf is the master configuration file for the
whole system.
The RPM ships with a mostly-default file -- you will need to tune the
parameters for your installation. In particular, you might want to allow
nonlocal TCP/IP socket connections -- in order to allow these, you will need
to edit the postgresql.conf file. The line in question contains the string
'listen_addresses' -- you need to both uncomment the line and set the value
to '*' to get the postmaster to accept nonlocal connections. You'll also need
to adjust pg_hba.conf appropriately.
LOGGING SET UP
-------------------------------------------------------------------------------
By default, the postmaster's stderr log is directed into files placed in a
pg_log subdirectory of the data directory (ie, /var/lib/pgsql/9.3/data/pg_log).
The out-of-the-box configuration rotates among seven files, one for each
day of the week. You can adjust this by changing postgresql.conf settings.
REBUILDING FROM SOURCE RPM
-------------------------------------------------------------------------------
If your distribution is not supported by the binary RPMs from PostgreSQL.org,
you will need to rebuild from the source RPM. Download the .src.rpm for this
release. You will need to be root to rebuild, unless you have set up
a non-root build environment (which is the recommended method anyway).
Install the source RPM with rpm -i, then cd to the rpm building area
(which is /usr/src/redhat by default). You will have to have a full
development environment to rebuild the full RPM set.
This release of the RPMset includes the ability to conditionally build
sets of packages. The parameters, their defaults, and the meanings are:
beta 0 #build with cassert and do not strip the binaries
python 1 #build the postgresql-python package.
tcl 1 #build the postgresql-tcl package.
test 1 #build the postgresql-test package.
plpython 1 #build the PL/Python procedural language package.
pltcl 1 #build the PL/Tcl procedural language package.
plperl 1 #build the PL/Perl procedural language package.
ssl 1 #use OpenSSL support.
kerberos 1 #use Kerberos 5 support.
nls 1 #build with national language support.
ldap 1 #build with LDAP support.
pam 1 #build with PAM support.
runselftest 1 #do "make check" during the build.
sdt 1 #build with SystemTap support.
xml 1 #build with XML support
pgfts 1 #build with --enable-thread-safety
uuid 1 #build contrib/uuid-ossp
To use these defines, invoke a rebuild like this:
rpmbuild --rebuild --define 'python 0' --define 'tcl 0' \
--define 'test 0' --define 'runselftest 0' --define 'kerberos 0' \
postgresql93-9.3.1-1PGDG.f17.src.rpm
This line would disable the python, tcl, and test subpackages, disable
the regression test run during build, and disable kerberos support.
You might need to disable runselftest if there is an installed version of
PostgreSQL that is a different major version from what you are trying to
build. The self test tends to pick up the installed libpq.so shared library
in place of the one being built :-(, so if that isn't compatible the test will
fail. Also, you can't use runselftest when doing the build as root.
More of these conditionals will be added in the future.
CONTRIB FILES
-------------------------------------------------------------------------------
The contents of the contrib tree are packaged into the -contrib subpackage
and are processed with make and make install. Most of the modules are in
/usr/pgsql-9.3/lib for loadable modules, and binaries are in
/usr/pgsql-9.3/bin. In the future these files may be split out,
depending upon function and dependencies.
MORE INFORMATION
-------------------------------------------------------------------------------
You can get more information at http://www.postgresql.org and
http://yum.postgresql.org
Please help make this packaging better -- let us know if you find problems, or
better ways of doing things. You can reach us by e-mail at
pgsql-pkg-yum@postgresql.org
-------------------------------------------------------------------------------

107
applock-1c-9.3.patch Normal file
View file

@ -0,0 +1,107 @@
--- ../postgresql-9.2.0.orig/src/backend/parser/gram.y 2011-09-09 01:13:28.000000000 +0400
+++ ./src/backend/parser/gram.y 2011-09-14 21:38:48.694882400 +0400
@@ -488,7 +488,7 @@
/* ordinary key words in alphabetical order */
%token <keyword> ABORT_P ABSOLUTE_P ACCESS ACTION ADD_P ADMIN AFTER
- AGGREGATE ALL ALSO ALTER ALWAYS ANALYSE ANALYZE AND ANY ARRAY AS ASC
+ AGGREGATE ALL ALSO ALTER ALWAYS ANALYSE ANALYZE AND ANY APPLICATION ARRAY AS ASC
ASSERTION ASSIGNMENT ASYMMETRIC AT ATTRIBUTE AUTHORIZATION
BACKWARD BEFORE BEGIN_P BETWEEN BIGINT BINARY BIT
@@ -8139,6 +8139,8 @@
lock_type: ACCESS SHARE { $$ = AccessShareLock; }
| ROW SHARE { $$ = RowShareLock; }
| ROW EXCLUSIVE { $$ = RowExclusiveLock; }
+ | APPLICATION SHARE { $$ = ApplicationShareLock; }
+ | APPLICATION EXCLUSIVE { $$ = ApplicationExclusiveLock; }
| SHARE UPDATE EXCLUSIVE { $$ = ShareUpdateExclusiveLock; }
| SHARE { $$ = ShareLock; }
| SHARE ROW EXCLUSIVE { $$ = ShareRowExclusiveLock; }
@@ -11828,6 +11830,7 @@
| ALSO
| ALTER
| ALWAYS
+ | APPLICATION
| ASSERTION
| ASSIGNMENT
| AT
--- --- ../postgresql-9.2.0.orig/src/backend/storage/lmgr/lock.c Thu Aug 23 22:06:50 2012 UTC
+++ ./src/backend/storage/lmgr/lock.c Mon Sep 10 07:35:10 2012 UTC
@@ -96,8 +96,14 @@
(1 << AccessShareLock) | (1 << RowShareLock) |
(1 << RowExclusiveLock) | (1 << ShareUpdateExclusiveLock) |
(1 << ShareLock) | (1 << ShareRowExclusiveLock) |
- (1 << ExclusiveLock) | (1 << AccessExclusiveLock)
+ (1 << ExclusiveLock) | (1 << AccessExclusiveLock),
+
+ /* ApplicationShareLock*/
+ (1 << ApplicationExclusiveLock),
+
+ /* ApplicationExclusiveLock*/
+ (1 << ApplicationExclusiveLock | 1 << ApplicationShareLock)
};
/* Names of lock modes, for debug printouts */
@@ -111,7 +117,9 @@
"ShareLock",
"ShareRowExclusiveLock",
"ExclusiveLock",
- "AccessExclusiveLock"
+ "AccessExclusiveLock",
+ "ApplicationShareLock",
+ "ApplicationExclusiveLock"
};
#ifndef LOCK_DEBUG
@@ -119,7 +127,7 @@
#endif
static const LockMethodData default_lockmethod = {
- AccessExclusiveLock, /* highest valid lock mode number */
+ ApplicationExclusiveLock, /* highest valid lock mode number */
LockConflicts,
lock_mode_names,
#ifdef LOCK_DEBUG
@@ -130,7 +138,7 @@
};
static const LockMethodData user_lockmethod = {
- AccessExclusiveLock, /* highest valid lock mode number */
+ ApplicationExclusiveLock, /* highest valid lock mode number */
LockConflicts,
lock_mode_names,
#ifdef LOCK_DEBUG
--- ../postgresql-9.2.0.orig/src/include/parser/kwlist.h 2011-09-09 01:13:28.000000000 +0400
+++ ./src/include/parser/kwlist.h 2011-09-14 19:40:30.858423500 +0400
@@ -42,6 +42,7 @@
PG_KEYWORD("analyze", ANALYZE, RESERVED_KEYWORD)
PG_KEYWORD("and", AND, RESERVED_KEYWORD)
PG_KEYWORD("any", ANY, RESERVED_KEYWORD)
+PG_KEYWORD("application", APPLICATION, UNRESERVED_KEYWORD)
PG_KEYWORD("array", ARRAY, RESERVED_KEYWORD)
PG_KEYWORD("as", AS, RESERVED_KEYWORD)
PG_KEYWORD("asc", ASC, RESERVED_KEYWORD)
--- ../postgresql-9.2.0_orig/src/include/storage/lock.h 2011-09-09 01:13:28.000000000 +0400
+++ ./src/include/storage/lock.h 2011-09-14 19:40:30.905223600 +0400
@@ -87,7 +87,7 @@
typedef int LOCKMODE;
/* MAX_LOCKMODES cannot be larger than the # of bits in LOCKMASK */
-#define MAX_LOCKMODES 10
+#define MAX_LOCKMODES 12
#define LOCKBIT_ON(lockmode) (1 << (lockmode))
#define LOCKBIT_OFF(lockmode) (~(1 << (lockmode)))
@@ -156,6 +156,9 @@
#define AccessExclusiveLock 8 /* ALTER TABLE, DROP TABLE, VACUUM
* FULL, and unqualified LOCK TABLE */
+#define ApplicationShareLock 9 /* requested explicitly */
+#define ApplicationExclusiveLock 10 /* requested explicitly */
+
/*
* LOCKTAG is the key information needed to look up a LOCK item in the

29
ecpg_config.h Normal file
View file

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

View file

@ -0,0 +1,3 @@
#!/bin/sh
/usr/lib/rpm/perl.req $* | grep -v 'perl(Pg'

812
online_analyze_93.patch Normal file
View file

@ -0,0 +1,812 @@
--- ../postgresql-9.3.0.orig/contrib/online_analyze/COPYRIGHT 1970-01-01 03:00:00.000000000 +0300
+++ ./contrib/online_analyze/COPYRIGHT 2013-09-10 12:33:46.000000000 +0400
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2011 Teodor Sigaev <teodor@sigaev.ru>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the author nor the names of any co-contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY CONTRIBUTORS ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
--- ../postgresql-9.3.0.orig/contrib/online_analyze/Makefile 1970-01-01 03:00:00.000000000 +0300
+++ ./contrib/online_analyze/Makefile 2013-09-10 12:33:46.000000000 +0400
@@ -0,0 +1,16 @@
+MODULE_big = online_analyze
+OBJS = online_analyze.o
+#DATA_built = online_analyze.sql
+DOCS = README.online_analyze
+#REGRESS = online_analyze
+
+ifdef USE_PGXS
+PGXS := $(shell pg_config --pgxs)
+include $(PGXS)
+else
+subdir = contrib/online_analyze
+top_builddir = ../..
+include $(top_builddir)/src/Makefile.global
+include $(top_srcdir)/contrib/contrib-global.mk
+endif
+
--- ../postgresql-9.3.0.orig/contrib/online_analyze/online_analyze.c 1970-01-01 03:00:00.000000000 +0300
+++ ./contrib/online_analyze/online_analyze.c 2013-09-10 12:33:46.000000000 +0400
@@ -0,0 +1,719 @@
+/*
+ * Copyright (c) 2011 Teodor Sigaev <teodor@sigaev.ru>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the author nor the names of any co-contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY CONTRIBUTORS ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "postgres.h"
+
+#include "pgstat.h"
+#include "catalog/namespace.h"
+#include "commands/vacuum.h"
+#include "executor/executor.h"
+#include "nodes/nodes.h"
+#include "nodes/parsenodes.h"
+#include "storage/bufmgr.h"
+#include "utils/builtins.h"
+#include "utils/lsyscache.h"
+#include "utils/guc.h"
+#if PG_VERSION_NUM >= 90200
+#include "catalog/pg_class.h"
+#include "nodes/primnodes.h"
+#include "tcop/utility.h"
+#include "utils/rel.h"
+#include "utils/relcache.h"
+#include "utils/timestamp.h"
+#endif
+
+#ifdef PG_MODULE_MAGIC
+PG_MODULE_MAGIC;
+#endif
+
+static bool online_analyze_enable = true;
+static bool online_analyze_verbose = true;
+static double online_analyze_scale_factor = 0.1;
+static int online_analyze_threshold = 50;
+static double online_analyze_min_interval = 10000;
+
+static ExecutorEnd_hook_type oldExecutorEndHook = NULL;
+#if PG_VERSION_NUM >= 90200
+static ProcessUtility_hook_type oldProcessUtilityHook = NULL;
+#endif
+
+typedef enum
+{
+ OATT_ALL = 0x03,
+ OATT_PERSISTENT = 0x01,
+ OATT_TEMPORARY = 0x02,
+ OATT_NONE = 0x00
+} OnlineAnalyzeTableType;
+
+static const struct config_enum_entry online_analyze_table_type_options[] =
+{
+ {"all", OATT_ALL, false},
+ {"persistent", OATT_PERSISTENT, false},
+ {"temporary", OATT_TEMPORARY, false},
+ {"none", OATT_NONE, false},
+ {NULL, 0, false},
+};
+
+static int online_analyze_table_type = (int)OATT_ALL;
+
+typedef struct TableList {
+ int nTables;
+ Oid *tables;
+ char *tableStr;
+} TableList;
+
+static TableList excludeTables = {0, NULL, NULL};
+static TableList includeTables = {0, NULL, NULL};
+
+static int
+oid_cmp(const void *a, const void *b)
+{
+ if (*(Oid*)a == *(Oid*)b)
+ return 0;
+ return (*(Oid*)a > *(Oid*)b) ? 1 : -1;
+}
+
+static const char *
+tableListAssign(const char * newval, bool doit, TableList *tbl)
+{
+ char *rawname;
+ List *namelist;
+ ListCell *l;
+ Oid *newOids = NULL;
+ int nOids = 0,
+ i = 0;
+
+ rawname = pstrdup(newval);
+
+ if (!SplitIdentifierString(rawname, ',', &namelist))
+ goto cleanup;
+
+ if (doit)
+ {
+ nOids = list_length(namelist);
+ newOids = malloc(sizeof(Oid) * (nOids+1));
+ if (!newOids)
+ elog(ERROR,"could not allocate %d bytes", (int)(sizeof(Oid) * (nOids+1)));
+ }
+
+ foreach(l, namelist)
+ {
+ char *curname = (char *) lfirst(l);
+#if PG_VERSION_NUM >= 90200
+ Oid relOid = RangeVarGetRelid(makeRangeVarFromNameList(stringToQualifiedNameList(curname)),
+ NoLock, true);
+#else
+ Oid relOid = RangeVarGetRelid(makeRangeVarFromNameList(stringToQualifiedNameList(curname)),
+ true);
+#endif
+
+ if (relOid == InvalidOid)
+ {
+#if PG_VERSION_NUM >= 90100
+ if (doit == false)
+#endif
+ elog(WARNING,"'%s' does not exist", curname);
+ continue;
+ }
+ else if ( get_rel_relkind(relOid) != RELKIND_RELATION )
+ {
+#if PG_VERSION_NUM >= 90100
+ if (doit == false)
+#endif
+ elog(WARNING,"'%s' is not an table", curname);
+ continue;
+ }
+ else if (doit)
+ {
+ newOids[i++] = relOid;
+ }
+ }
+
+ if (doit)
+ {
+ tbl->nTables = i;
+ if (tbl->tables)
+ free(tbl->tables);
+ tbl->tables = newOids;
+ if (tbl->nTables > 1)
+ qsort(tbl->tables, tbl->nTables, sizeof(tbl->tables[0]), oid_cmp);
+ }
+
+ pfree(rawname);
+ list_free(namelist);
+
+ return newval;
+
+cleanup:
+ if (newOids)
+ free(newOids);
+ pfree(rawname);
+ list_free(namelist);
+ return NULL;
+}
+
+#if PG_VERSION_NUM >= 90100
+static bool
+excludeTablesCheck(char **newval, void **extra, GucSource source)
+{
+ char *val;
+
+ val = (char*)tableListAssign(*newval, false, &excludeTables);
+
+ if (val)
+ {
+ *newval = val;
+ return true;
+ }
+
+ return false;
+}
+
+static void
+excludeTablesAssign(const char *newval, void *extra)
+{
+ tableListAssign(newval, true, &excludeTables);
+}
+
+static bool
+includeTablesCheck(char **newval, void **extra, GucSource source)
+{
+ char *val;
+
+ val = (char*)tableListAssign(*newval, false, &includeTables);
+
+ if (val)
+ {
+ *newval = val;
+ return true;
+ }
+
+ return false;
+}
+
+static void
+includeTablesAssign(const char *newval, void *extra)
+{
+ tableListAssign(newval, true, &excludeTables);
+}
+
+#else /* PG_VERSION_NUM < 90100 */
+
+static const char *
+excludeTablesAssign(const char * newval, bool doit, GucSource source)
+{
+ return tableListAssign(newval, doit, &excludeTables);
+}
+
+static const char *
+includeTablesAssign(const char * newval, bool doit, GucSource source)
+{
+ return tableListAssign(newval, doit, &includeTables);
+}
+
+#endif
+
+static const char*
+tableListShow(TableList *tbl)
+{
+ char *val, *ptr;
+ int i,
+ len;
+
+ len = 1 /* \0 */ + tbl->nTables * (2 * NAMEDATALEN + 2 /* ', ' */ + 1 /* . */);
+ ptr = val = palloc(len);
+ *ptr ='\0';
+ for(i=0; i<tbl->nTables; i++)
+ {
+ char *relname = get_rel_name(tbl->tables[i]);
+ Oid nspOid = get_rel_namespace(tbl->tables[i]);
+ char *nspname = get_namespace_name(nspOid);
+
+ if ( relname == NULL || nspOid == InvalidOid || nspname == NULL )
+ continue;
+
+ ptr += snprintf(ptr, len - (ptr - val), "%s%s.%s",
+ (i==0) ? "" : ", ",
+ nspname, relname);
+ }
+
+ return val;
+}
+
+static const char*
+excludeTablesShow(void)
+{
+ return tableListShow(&excludeTables);
+}
+
+static const char*
+includeTablesShow(void)
+{
+ return tableListShow(&includeTables);
+}
+
+static bool
+matchOid(TableList *tbl, Oid oid)
+{
+ Oid *StopLow = tbl->tables,
+ *StopHigh = tbl->tables + tbl->nTables,
+ *StopMiddle;
+
+ /* Loop invariant: StopLow <= val < StopHigh */
+ while (StopLow < StopHigh)
+ {
+ StopMiddle = StopLow + ((StopHigh - StopLow) >> 1);
+
+ if (*StopMiddle == oid)
+ return true;
+ else if (*StopMiddle < oid)
+ StopLow = StopMiddle + 1;
+ else
+ StopHigh = StopMiddle;
+ }
+
+ return false;
+}
+
+static void
+makeAnalyze(Oid relOid, CmdType operation, uint32 naffected)
+{
+ PgStat_StatTabEntry *tabentry;
+ TimestampTz now = GetCurrentTimestamp();
+
+ if (relOid == InvalidOid)
+ return;
+
+ if (get_rel_relkind(relOid) != RELKIND_RELATION)
+ return;
+
+ tabentry = pgstat_fetch_stat_tabentry(relOid);
+
+#if PG_VERSION_NUM >= 90000
+#define changes_since_analyze(t) ((t)->changes_since_analyze)
+#else
+#define changes_since_analyze(t) ((t)->n_live_tuples + (t)->n_dead_tuples - (t)->last_anl_tuples)
+#endif
+
+ if (
+ tabentry == NULL /* a new table */ ||
+ (
+ /* do not analyze too often, if both stamps are exceeded the go */
+ TimestampDifferenceExceeds(tabentry->analyze_timestamp, now, online_analyze_min_interval) &&
+ TimestampDifferenceExceeds(tabentry->autovac_analyze_timestamp, now, online_analyze_min_interval) &&
+ /* be in sync with relation_needs_vacanalyze */
+ ((double)(changes_since_analyze(tabentry) + naffected)) >=
+ online_analyze_scale_factor * ((double)(tabentry->n_dead_tuples + tabentry->n_live_tuples)) +
+ (double)online_analyze_threshold
+ )
+ )
+ {
+ VacuumStmt vacstmt;
+ TimestampTz startStamp, endStamp;
+
+ memset(&startStamp, 0, sizeof(startStamp)); /* keep compiler quiet */
+
+ /*
+ * includeTables overwrites excludeTables
+ */
+ switch(online_analyze_table_type)
+ {
+ case OATT_ALL:
+ if (matchOid(&excludeTables, relOid) == true && matchOid(&includeTables, relOid) == false)
+ return;
+ break;
+ case OATT_NONE:
+ if (matchOid(&includeTables, relOid) == false)
+ return;
+ break;
+ case OATT_TEMPORARY:
+ case OATT_PERSISTENT:
+ default:
+ {
+ Relation rel;
+ OnlineAnalyzeTableType reltype;
+
+ rel = RelationIdGetRelation(relOid);
+ reltype =
+#if PG_VERSION_NUM >= 90100
+ (rel->rd_rel->relpersistence == RELPERSISTENCE_TEMP)
+#else
+ (rel->rd_istemp || rel->rd_islocaltemp)
+#endif
+ ? OATT_TEMPORARY : OATT_PERSISTENT;
+ RelationClose(rel);
+
+ /*
+ * skip analyze if relation's type doesn't not match online_analyze_table_type
+ */
+ if ((online_analyze_table_type & reltype) == 0 || matchOid(&excludeTables, relOid) == true)
+ {
+ if (matchOid(&includeTables, relOid) == false)
+ return;
+ }
+ }
+ break;
+ }
+
+ vacstmt.type = T_VacuumStmt;
+ vacstmt.freeze_min_age = -1;
+ vacstmt.freeze_table_age = -1; /* ??? */
+ vacstmt.relation = NULL;
+ vacstmt.va_cols = NIL;
+
+#if PG_VERSION_NUM >= 90000
+ vacstmt.options = VACOPT_ANALYZE;
+ if (online_analyze_verbose)
+ vacstmt.options |= VACOPT_VERBOSE;
+#else
+ vacstmt.vacuum = vacstmt.full = false;
+ vacstmt.analyze = true;
+ vacstmt.verbose = online_analyze_verbose;
+#endif
+
+ if (online_analyze_verbose)
+ startStamp = GetCurrentTimestamp();
+
+ analyze_rel(relOid, &vacstmt, GetAccessStrategy(BAS_VACUUM)
+#if (PG_VERSION_NUM < 90004) && (PG_VERSION_NUM >= 90000)
+ , true
+#endif
+ );
+
+ if (online_analyze_verbose)
+ {
+ long secs;
+ int microsecs;
+
+ endStamp = GetCurrentTimestamp();
+ TimestampDifference(startStamp, endStamp, &secs, &microsecs);
+ elog(INFO, "analyze \"%s\" took %.02f seconds",
+ get_rel_name(relOid), ((double)secs) + ((double)microsecs)/1.0e6);
+ }
+
+
+ if (tabentry == NULL)
+ {
+ /* new table */
+ pgstat_clear_snapshot();
+ }
+ else
+ {
+ /* update last analyze timestamp in local memory of backend */
+ tabentry->analyze_timestamp = now;
+ }
+ }
+#if PG_VERSION_NUM >= 90000
+ else if (tabentry != NULL)
+ {
+ tabentry->changes_since_analyze += naffected;
+ }
+#endif
+}
+
+extern PGDLLIMPORT void onlineAnalyzeHooker(QueryDesc *queryDesc);
+void
+onlineAnalyzeHooker(QueryDesc *queryDesc)
+{
+ uint32 naffected = 0;
+
+ if (queryDesc->estate)
+ naffected = queryDesc->estate->es_processed;
+
+ if (online_analyze_enable && queryDesc->plannedstmt &&
+ (queryDesc->operation == CMD_INSERT ||
+ queryDesc->operation == CMD_UPDATE ||
+ queryDesc->operation == CMD_DELETE
+#if PG_VERSION_NUM < 90200
+ || (queryDesc->operation == CMD_SELECT && queryDesc->plannedstmt->intoClause)
+#endif
+ ))
+ {
+#if PG_VERSION_NUM < 90200
+ if (queryDesc->operation == CMD_SELECT)
+ {
+ Oid relOid = RangeVarGetRelid(queryDesc->plannedstmt->intoClause->rel, true);
+
+ makeAnalyze(relOid, queryDesc->operation, naffected);
+ }
+ else
+#endif
+ if (queryDesc->plannedstmt->resultRelations &&
+ queryDesc->plannedstmt->rtable)
+ {
+ ListCell *l;
+
+ foreach(l, queryDesc->plannedstmt->resultRelations)
+ {
+ int n = lfirst_int(l);
+ RangeTblEntry *rte = list_nth(queryDesc->plannedstmt->rtable, n-1);
+
+ if (rte->rtekind == RTE_RELATION)
+ makeAnalyze(rte->relid, queryDesc->operation, naffected);
+ }
+ }
+ }
+
+ if (oldExecutorEndHook)
+ oldExecutorEndHook(queryDesc);
+ else
+ standard_ExecutorEnd(queryDesc);
+}
+
+#if PG_VERSION_NUM >= 90200
+static void
+onlineAnalyzeHookerUtility(Node *parsetree, const char *queryString,
+#if PG_VERSION_NUM >= 90300
+ ProcessUtilityContext context, ParamListInfo params,
+#else
+ ParamListInfo params, bool isTopLevel,
+#endif
+ DestReceiver *dest, char *completionTag) {
+ RangeVar *tblname = NULL;
+
+ if (IsA(parsetree, CreateTableAsStmt) && ((CreateTableAsStmt*)parsetree)->into)
+ tblname = (RangeVar*)copyObject(((CreateTableAsStmt*)parsetree)->into->rel);
+
+ if (oldProcessUtilityHook)
+ oldProcessUtilityHook(parsetree, queryString,
+#if PG_VERSION_NUM >= 90300
+ context, params,
+#else
+ params, isTopLevel,
+#endif
+ dest, completionTag);
+ else
+ standard_ProcessUtility(parsetree, queryString,
+#if PG_VERSION_NUM >= 90300
+ context, params,
+#else
+ params, isTopLevel,
+#endif
+ dest, completionTag);
+
+ if (tblname) {
+ Oid tblOid = RangeVarGetRelid(tblname, NoLock, true);
+
+ makeAnalyze(tblOid, CMD_INSERT, 0);
+ }
+}
+#endif
+
+void _PG_init(void);
+void
+_PG_init(void)
+{
+ oldExecutorEndHook = ExecutorEnd_hook;
+
+ ExecutorEnd_hook = onlineAnalyzeHooker;
+
+#if PG_VERSION_NUM >= 90200
+ oldProcessUtilityHook = ProcessUtility_hook;
+
+ ProcessUtility_hook = onlineAnalyzeHookerUtility;
+#endif
+
+
+ DefineCustomBoolVariable(
+ "online_analyze.enable",
+ "Enable on-line analyze",
+ "Enables analyze of table directly after insert/update/delete/select into",
+ &online_analyze_enable,
+#if PG_VERSION_NUM >= 80400
+ online_analyze_enable,
+#endif
+ PGC_USERSET,
+#if PG_VERSION_NUM >= 80400
+ GUC_NOT_IN_SAMPLE,
+#if PG_VERSION_NUM >= 90100
+ NULL,
+#endif
+#endif
+ NULL,
+ NULL
+ );
+
+ DefineCustomBoolVariable(
+ "online_analyze.verbose",
+ "Verbosity of on-line analyze",
+ "Make ANALYZE VERBOSE after table's changes",
+ &online_analyze_verbose,
+#if PG_VERSION_NUM >= 80400
+ online_analyze_verbose,
+#endif
+ PGC_USERSET,
+#if PG_VERSION_NUM >= 80400
+ GUC_NOT_IN_SAMPLE,
+#if PG_VERSION_NUM >= 90100
+ NULL,
+#endif
+#endif
+ NULL,
+ NULL
+ );
+
+ DefineCustomRealVariable(
+ "online_analyze.scale_factor",
+ "fraction of table size to start on-line analyze",
+ "fraction of table size to start on-line analyze",
+ &online_analyze_scale_factor,
+#if PG_VERSION_NUM >= 80400
+ online_analyze_scale_factor,
+#endif
+ 0.0,
+ 1.0,
+ PGC_USERSET,
+#if PG_VERSION_NUM >= 80400
+ GUC_NOT_IN_SAMPLE,
+#if PG_VERSION_NUM >= 90100
+ NULL,
+#endif
+#endif
+ NULL,
+ NULL
+ );
+
+ DefineCustomIntVariable(
+ "online_analyze.threshold",
+ "min number of row updates before on-line analyze",
+ "min number of row updates before on-line analyze",
+ &online_analyze_threshold,
+#if PG_VERSION_NUM >= 80400
+ online_analyze_threshold,
+#endif
+ 0,
+ 0x7fffffff,
+ PGC_USERSET,
+#if PG_VERSION_NUM >= 80400
+ GUC_NOT_IN_SAMPLE,
+#if PG_VERSION_NUM >= 90100
+ NULL,
+#endif
+#endif
+ NULL,
+ NULL
+ );
+
+ DefineCustomRealVariable(
+ "online_analyze.min_interval",
+ "minimum time interval between analyze call (in milliseconds)",
+ "minimum time interval between analyze call (in milliseconds)",
+ &online_analyze_min_interval,
+#if PG_VERSION_NUM >= 80400
+ online_analyze_min_interval,
+#endif
+ 0.0,
+ 1e30,
+ PGC_USERSET,
+#if PG_VERSION_NUM >= 80400
+ GUC_NOT_IN_SAMPLE,
+#if PG_VERSION_NUM >= 90100
+ NULL,
+#endif
+#endif
+ NULL,
+ NULL
+ );
+
+ DefineCustomEnumVariable(
+ "online_analyze.table_type",
+ "Type(s) of table for online analyze: all(default), persistent, temporary, none",
+ NULL,
+ &online_analyze_table_type,
+#if PG_VERSION_NUM >= 80400
+ online_analyze_table_type,
+#endif
+ online_analyze_table_type_options,
+ PGC_USERSET,
+#if PG_VERSION_NUM >= 80400
+ GUC_NOT_IN_SAMPLE,
+#if PG_VERSION_NUM >= 90100
+ NULL,
+#endif
+#endif
+ NULL,
+ NULL
+ );
+
+ DefineCustomStringVariable(
+ "online_analyze.exclude_tables",
+ "List of tables which will not online analyze",
+ NULL,
+ &excludeTables.tableStr,
+#if PG_VERSION_NUM >= 80400
+ "",
+#endif
+ PGC_USERSET,
+ 0,
+#if PG_VERSION_NUM >= 90100
+ excludeTablesCheck,
+ excludeTablesAssign,
+#else
+ excludeTablesAssign,
+#endif
+ excludeTablesShow
+ );
+
+ DefineCustomStringVariable(
+ "online_analyze.include_tables",
+ "List of tables which will online analyze",
+ NULL,
+ &includeTables.tableStr,
+#if PG_VERSION_NUM >= 80400
+ "",
+#endif
+ PGC_USERSET,
+ 0,
+#if PG_VERSION_NUM >= 90100
+ includeTablesCheck,
+ includeTablesAssign,
+#else
+ includeTablesAssign,
+#endif
+ includeTablesShow
+ );
+}
+
+void _PG_fini(void);
+void
+_PG_fini(void)
+{
+ ExecutorEnd_hook = oldExecutorEndHook;
+#if PG_VERSION_NUM >= 90200
+ ProcessUtility_hook = oldProcessUtilityHook;
+#endif
+
+ if (excludeTables.tables)
+ free(excludeTables.tables);
+ if (includeTables.tables)
+ free(includeTables.tables);
+
+ excludeTables.tables = includeTables.tables = NULL;
+ excludeTables.nTables = includeTables.nTables = 0;
+}
--- ../postgresql-9.3.0.orig/contrib/online_analyze/README.online_analyze 1970-01-01 03:00:00.000000000 +0300
+++ ./contrib/online_analyze/README.online_analyze 2013-09-10 12:33:46.000000000 +0400
@@ -0,0 +1,36 @@
+Module makes an analyze call immediately after INSERT/UPDATE/DELETE/SELECT INTO
+for affected table(s).
+
+Supported versionsi of PostgreSQL: 8.4.*, 9.0.*, 9.1.*, 9.2.*, 9.3.*
+
+Usage: LOAD 'online_analyze';
+
+Custom variables (defaults values are shown):
+online_analyze.enable = on
+ Enables on-line analyze
+
+online_analyze.verbose = on
+ Execute ANALYZE VERBOSE
+
+online_analyze.scale_factor = 0.1
+ Fraction of table size to start on-line analyze (similar to
+ autovacuum_analyze_scale_factor)
+
+online_analyze.threshold = 50
+ Min number of row updates before on-line analyze (similar to
+ autovacuum_analyze_threshold)
+
+online_analyze.min_interval = 10000
+ Minimum time interval between analyze call per table (in milliseconds)
+
+online_analyze.table_type = "all"
+ Type(s) of table for online analyze: all, persistent, temporary, none
+
+online_analyze.exclude_tables = ""
+ List of tables which will not online analyze
+
+online_analyze.include_tables = ""
+ List of tables which will online analyze
+ online_analyze.include_tables overwrites online_analyze.exclude_tables.
+
+Author: Teodor Sigaev <teodor@sigaev.ru>

29
pg_config.h Normal file
View file

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

671
plantuner.patch Normal file
View file

@ -0,0 +1,671 @@
diff -urN ../postgresql-9.2.0.orig/contrib/plantuner\COPYRIGHT ./contrib/plantuner/COPYRIGHT
--- ../postgresql-9.2.0.orig/contrib/plantuner/COPYRIGHT Thu Jan 01 04:00:00 1970
+++ ./contrib/plantuner/COPYRIGHT Mon Sep 17 20:00:32 2012
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2009 Teodor Sigaev <teodor@sigaev.ru>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the author nor the names of any co-contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY CONTRIBUTORS ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
diff -urN ../postgresql-9.2.0.orig/contrib/plantuner/expected/plantuner.out ./contrib/plantuner/expected/plantuner.out
--- ../postgresql-9.2.0.orig/contrib/plantuner/expected/plantuner.out Thu Jan 01 04:00:00 1970
+++ ./contrib/plantuner/expected/plantuner.out Mon Sep 17 20:00:32 2012
@@ -0,0 +1,49 @@
+LOAD 'plantuner';
+SHOW plantuner.disable_index;
+ plantuner.disable_index
+-------------------------
+
+(1 row)
+
+CREATE TABLE wow (i int, j int);
+CREATE INDEX i_idx ON wow (i);
+CREATE INDEX j_idx ON wow (j);
+SET enable_seqscan=off;
+SELECT * FROM wow;
+ i | j
+---+---
+(0 rows)
+
+SET plantuner.disable_index="i_idx, j_idx";
+SELECT * FROM wow;
+ i | j
+---+---
+(0 rows)
+
+SHOW plantuner.disable_index;
+ plantuner.disable_index
+----------------------------
+ public.i_idx, public.j_idx
+(1 row)
+
+SET plantuner.disable_index="i_idx, nonexistent, public.j_idx, wow";
+WARNING: 'nonexistent' does not exist
+WARNING: 'wow' is not an index
+SHOW plantuner.disable_index;
+ plantuner.disable_index
+----------------------------
+ public.i_idx, public.j_idx
+(1 row)
+
+SET plantuner.enable_index="i_idx";
+SHOW plantuner.enable_index;
+ plantuner.enable_index
+------------------------
+ public.i_idx
+(1 row)
+
+SELECT * FROM wow;
+ i | j
+---+---
+(0 rows)
+
diff -urN ../postgresql-9.2.0.orig/contrib/plantuner/Makefile ./contrib/plantuner/Makefile
--- ../postgresql-9.2.0.orig/contrib/plantuner/Makefile Thu Jan 01 04:00:00 1970
+++ ./contrib/plantuner/Makefile Mon Sep 17 20:00:32 2012
@@ -0,0 +1,15 @@
+MODULE_big = plantuner
+DOCS = README.plantuner
+REGRESS = plantuner
+OBJS=plantuner.o
+
+ifdef USE_PGXS
+PGXS = $(shell pg_config --pgxs)
+include $(PGXS)
+else
+subdir = contrib/plantuner
+top_builddir = ../..
+include $(top_builddir)/src/Makefile.global
+
+include $(top_srcdir)/contrib/contrib-global.mk
+endif
diff -urN ../postgresql-9.2.0.orig/contrib/plantuner/plantuner.c ./contrib/plantuner/plantuner.c
--- ../postgresql-9.2.0.orig/contrib/plantuner/plantuner.c Thu Jan 01 04:00:00 1970
+++ ./contrib/plantuner/plantuner.c Mon Sep 17 20:00:32 2012
@@ -0,0 +1,378 @@
+/*
+ * Copyright (c) 2009 Teodor Sigaev <teodor@sigaev.ru>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the author nor the names of any co-contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY CONTRIBUTORS ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <postgres.h>
+
+#include <fmgr.h>
+#include <access/heapam.h>
+#include <catalog/namespace.h>
+#include <catalog/pg_class.h>
+#include <nodes/pg_list.h>
+#include <optimizer/plancat.h>
+#include <storage/bufmgr.h>
+#include <utils/builtins.h>
+#include <utils/guc.h>
+#include <utils/lsyscache.h>
+#include <utils/rel.h>
+
+PG_MODULE_MAGIC;
+
+static int nDisabledIndexes = 0;
+static Oid *disabledIndexes = NULL;
+static char *disableIndexesOutStr = "";
+
+static int nEnabledIndexes = 0;
+static Oid *enabledIndexes = NULL;
+static char *enableIndexesOutStr = "";
+
+get_relation_info_hook_type prevHook = NULL;
+static bool fix_empty_table = false;
+
+
+static const char *
+indexesAssign(const char * newval, bool doit, GucSource source, bool isDisable)
+{
+ char *rawname;
+ List *namelist;
+ ListCell *l;
+ Oid *newOids = NULL;
+ int nOids = 0,
+ i = 0;
+
+ rawname = pstrdup(newval);
+
+ if (!SplitIdentifierString(rawname, ',', &namelist))
+ goto cleanup;
+
+ if (doit)
+ {
+ nOids = list_length(namelist);
+ newOids = malloc(sizeof(Oid) * (nOids+1));
+ if (!newOids)
+ elog(ERROR,"could not allocate %d bytes", (int)(sizeof(Oid) * (nOids+1)));
+ }
+
+ foreach(l, namelist)
+ {
+ char *curname = (char *) lfirst(l);
+#if PG_VERSION_NUM >= 90200
+ Oid indexOid = RangeVarGetRelid(makeRangeVarFromNameList(stringToQualifiedNameList(curname)),
+ NoLock, true);
+#else
+ Oid indexOid = RangeVarGetRelid(makeRangeVarFromNameList(stringToQualifiedNameList(curname)),
+ true);
+#endif
+
+ if (indexOid == InvalidOid)
+ {
+#if PG_VERSION_NUM >= 90100
+ if (doit == false)
+#endif
+ elog(WARNING,"'%s' does not exist", curname);
+ continue;
+ }
+ else if ( get_rel_relkind(indexOid) != RELKIND_INDEX )
+ {
+#if PG_VERSION_NUM >= 90100
+ if (doit == false)
+#endif
+ elog(WARNING,"'%s' is not an index", curname);
+ continue;
+ }
+ else if (doit)
+ {
+ newOids[i++] = indexOid;
+ }
+ }
+
+ if (doit)
+ {
+ if (isDisable)
+ {
+ nDisabledIndexes = nOids;
+ disabledIndexes = newOids;
+ }
+ else
+ {
+ nEnabledIndexes = nOids;
+ enabledIndexes = newOids;
+ }
+ }
+
+ pfree(rawname);
+ list_free(namelist);
+
+ return newval;
+
+cleanup:
+ if (newOids)
+ free(newOids);
+ pfree(rawname);
+ list_free(namelist);
+ return NULL;
+}
+
+static const char *
+assignDisabledIndexes(const char * newval, bool doit, GucSource source)
+{
+ return indexesAssign(newval, doit, source, true);
+}
+
+static const char *
+assignEnabledIndexes(const char * newval, bool doit, GucSource source)
+{
+ return indexesAssign(newval, doit, source, false);
+}
+
+#if PG_VERSION_NUM >= 90100
+
+static bool
+checkDisabledIndexes(char **newval, void **extra, GucSource source)
+{
+ char *val;
+
+ val = (char*)indexesAssign(*newval, false, source, true);
+
+ if (val)
+ {
+ *newval = val;
+ return true;
+ }
+
+ return false;
+}
+
+static bool
+checkEnabledIndexes(char **newval, void **extra, GucSource source)
+{
+ char *val;
+
+ val = (char*)indexesAssign(*newval, false, source, false);
+
+ if (val)
+ {
+ *newval = val;
+ return true;
+ }
+
+ return false;
+}
+
+static void
+assignDisabledIndexesNew(const char *newval, void *extra)
+{
+ assignDisabledIndexes(newval, true, PGC_S_USER /* doesn't matter */);
+}
+
+static void
+assignEnabledIndexesNew(const char *newval, void *extra)
+{
+ assignEnabledIndexes(newval, true, PGC_S_USER /* doesn't matter */);
+}
+
+#endif
+
+static void
+indexFilter(PlannerInfo *root, Oid relationObjectId, bool inhparent, RelOptInfo *rel) {
+ int i;
+
+ for(i=0;i<nDisabledIndexes;i++)
+ {
+ ListCell *l;
+
+ foreach(l, rel->indexlist)
+ {
+ IndexOptInfo *info = (IndexOptInfo*)lfirst(l);
+
+ if (disabledIndexes[i] == info->indexoid)
+ {
+ int j;
+
+ for(j=0; j<nEnabledIndexes; j++)
+ if (enabledIndexes[j] == info->indexoid)
+ break;
+
+ if (j >= nEnabledIndexes)
+ rel->indexlist = list_delete_ptr(rel->indexlist, info);
+
+ break;
+ }
+ }
+ }
+}
+
+static void
+execPlantuner(PlannerInfo *root, Oid relationObjectId, bool inhparent, RelOptInfo *rel) {
+ Relation relation;
+
+ relation = heap_open(relationObjectId, NoLock);
+ if (relation->rd_rel->relkind == RELKIND_RELATION)
+ {
+ if (fix_empty_table && RelationGetNumberOfBlocks(relation) == 0)
+ {
+ /*
+ * estimate_rel_size() could be too pessimistic for particular
+ * workload
+ */
+ rel->pages = 0.0;
+ rel->tuples = 0.0;
+ }
+
+ indexFilter(root, relationObjectId, inhparent, rel);
+ }
+ heap_close(relation, NoLock);
+
+ /*
+ * Call next hook if it exists
+ */
+ if (prevHook)
+ prevHook(root, relationObjectId, inhparent, rel);
+}
+
+static const char*
+IndexFilterShow(Oid* indexes, int nIndexes)
+{
+ char *val, *ptr;
+ int i,
+ len;
+
+ len = 1 /* \0 */ + nIndexes * (2 * NAMEDATALEN + 2 /* ', ' */ + 1 /* . */);
+ ptr = val = palloc(len);
+
+ *ptr =(char)'\0';
+ for(i=0; i<nIndexes; i++)
+ {
+ char *relname = get_rel_name(indexes[i]);
+ Oid nspOid = get_rel_namespace(indexes[i]);
+ char *nspname = get_namespace_name(nspOid);
+
+ if ( relname == NULL || nspOid == InvalidOid || nspname == NULL )
+ continue;
+
+ ptr += snprintf(ptr, len - (ptr - val), "%s%s.%s",
+ (i==0) ? "" : ", ",
+ nspname,
+ relname);
+ }
+
+ return val;
+}
+
+static const char*
+disabledIndexFilterShow(void)
+{
+ return IndexFilterShow(disabledIndexes, nDisabledIndexes);
+}
+
+static const char*
+enabledIndexFilterShow(void)
+{
+ return IndexFilterShow(enabledIndexes, nEnabledIndexes);
+}
+
+void _PG_init(void);
+void
+_PG_init(void)
+{
+ DefineCustomStringVariable(
+ "plantuner.forbid_index",
+ "List of forbidden indexes (deprecated)",
+ "Listed indexes will not be used in queries (deprecated, use plantuner.disable_index)",
+ &disableIndexesOutStr,
+ "",
+ PGC_USERSET,
+ 0,
+#if PG_VERSION_NUM >= 90100
+ checkDisabledIndexes,
+ assignDisabledIndexesNew,
+#else
+ assignDisabledIndexes,
+#endif
+ disabledIndexFilterShow
+ );
+
+ DefineCustomStringVariable(
+ "plantuner.disable_index",
+ "List of disabled indexes",
+ "Listed indexes will not be used in queries",
+ &disableIndexesOutStr,
+ "",
+ PGC_USERSET,
+ 0,
+#if PG_VERSION_NUM >= 90100
+ checkDisabledIndexes,
+ assignDisabledIndexesNew,
+#else
+ assignDisabledIndexes,
+#endif
+ disabledIndexFilterShow
+ );
+
+ DefineCustomStringVariable(
+ "plantuner.enable_index",
+ "List of enabled indexes (overload plantuner.disable_index)",
+ "Listed indexes which could be used in queries even they are listed in plantuner.disable_index",
+ &enableIndexesOutStr,
+ "",
+ PGC_USERSET,
+ 0,
+#if PG_VERSION_NUM >= 90100
+ checkEnabledIndexes,
+ assignEnabledIndexesNew,
+#else
+ assignEnabledIndexes,
+#endif
+ enabledIndexFilterShow
+ );
+
+ DefineCustomBoolVariable(
+ "plantuner.fix_empty_table",
+ "Sets to zero estimations for empty tables",
+ "Sets to zero estimations for empty or newly created tables",
+ &fix_empty_table,
+#if PG_VERSION_NUM >= 80400
+ fix_empty_table,
+#endif
+ PGC_USERSET,
+#if PG_VERSION_NUM >= 80400
+ GUC_NOT_IN_SAMPLE,
+#if PG_VERSION_NUM >= 90100
+ NULL,
+#endif
+#endif
+ NULL,
+ NULL
+ );
+
+ if (get_relation_info_hook != execPlantuner )
+ {
+ prevHook = get_relation_info_hook;
+ get_relation_info_hook = execPlantuner;
+ }
+}
diff -urN ../postgresql-9.2.0.orig/contrib/plantuner/README.plantuner ./contrib/plantuner/README.plantuner
--- ../postgresql-9.2.0.orig/contrib/plantuner/README.plantuner Thu Jan 01 04:00:00 1970
+++ ./contrib/plantuner/README.plantuner Mon Sep 17 20:00:32 2012
@@ -0,0 +1,96 @@
+Plantuner - enable planner hints
+
+ contrib/plantuner is a contribution module for PostgreSQL 8.4+, which
+ enable planner hints.
+
+ All work was done by Teodor Sigaev (teodor@sigaev.ru) and Oleg Bartunov
+ (oleg@sai.msu.su).
+
+ Sponsor: Nomao project (http://www.nomao.com)
+
+Motivation
+
+ Whether somebody think it's bad or not, but sometime it's very
+ interesting to be able to control planner (provide hints, which tells
+ optimizer to ignore its algorithm in part), which is currently
+ impossible in POstgreSQL. Oracle, for example, has over 120 hints, SQL
+ Server also provides hints.
+
+ This first version of plantuner provides a possibility to hide
+ specified indexes from PostgreSQL planner, so it will not use them.
+
+ There are many situation, when developer want to temporarily disable
+ specific index(es), without dropping them, or to instruct planner to
+ use specific index.
+
+ Next, for some workload PostgreSQL could be too pessimistic for
+ newly created tables and assumes much more rows in table than
+ it actually has. If plantuner.fix_empty_table GUC variable is set
+ to true then module will set to zero number of pages/tuples of
+ table which hasn't blocks in file.
+
+Installation
+
+ * Get latest source of plantuner from CVS Repository
+ * gmake && gmake install && gmake installcheck
+
+Syntax
+ plantuner.forbid_index (deprecated)
+ plantuner.disable_index
+ List of indexes invisible to planner
+ plantuner.enable_index
+ List of indexes visible to planner even they are hided
+ by plantuner.disable_index.
+
+Usage
+
+ To enable the module you can either load shared library 'plantuner' in
+ psql session or specify 'shared_preload_libraries' option in
+ postgresql.conf.
+=# LOAD 'plantuner';
+=# create table test(id int);
+=# create index id_idx on test(id);
+=# create index id_idx2 on test(id);
+=# \d test
+ Table "public.test"
+ Column | Type | Modifiers
+--------+---------+-----------
+ id | integer |
+Indexes:
+ "id_idx" btree (id)
+ "id_idx2" btree (id)
+=# explain select id from test where id=1;
+ QUERY PLAN
+-----------------------------------------------------------------------
+ Bitmap Heap Scan on test (cost=4.34..15.03 rows=12 width=4)
+ Recheck Cond: (id = 1)
+ -> Bitmap Index Scan on id_idx2 (cost=0.00..4.34 rows=12 width=0)
+ Index Cond: (id = 1)
+(4 rows)
+=# set enable_seqscan=off;
+=# set plantuner.disable_index='id_idx2';
+=# explain select id from test where id=1;
+ QUERY PLAN
+----------------------------------------------------------------------
+ Bitmap Heap Scan on test (cost=4.34..15.03 rows=12 width=4)
+ Recheck Cond: (id = 1)
+ -> Bitmap Index Scan on id_idx (cost=0.00..4.34 rows=12 width=0)
+ Index Cond: (id = 1)
+(4 rows)
+=# set plantuner.disable_index='id_idx2,id_idx';
+=# explain select id from test where id=1;
+ QUERY PLAN
+-------------------------------------------------------------------------
+ Seq Scan on test (cost=10000000000.00..10000000040.00 rows=12 width=4)
+ Filter: (id = 1)
+(2 rows)
+=# set plantuner.enable_index='id_idx';
+=# explain select id from test where id=1;
+ QUERY PLAN
+-----------------------------------------------------------------------
+ Bitmap Heap Scan on test (cost=4.34..15.03 rows=12 width=4)
+ Recheck Cond: (id = 1)
+ -> Bitmap Index Scan on id_idx (cost=0.00..4.34 rows=12 width=0)
+ Index Cond: (id = 1)
+(4 rows)
+
diff -urN ../postgresql-9.2.0.orig/contrib/plantuner/results/plantuner.out ./contrib/plantuner/results/plantuner.out
--- ../postgresql-9.2.0.orig/contrib/plantuner/results/plantuner.out Thu Jan 01 04:00:00 1970
+++ ./contrib/plantuner/results/plantuner.out Tue Sep 18 11:59:30 2012
@@ -0,0 +1,49 @@
+LOAD 'plantuner';
+SHOW plantuner.disable_index;
+ plantuner.disable_index
+-------------------------
+
+(1 row)
+
+CREATE TABLE wow (i int, j int);
+CREATE INDEX i_idx ON wow (i);
+CREATE INDEX j_idx ON wow (j);
+SET enable_seqscan=off;
+SELECT * FROM wow;
+ i | j
+---+---
+(0 rows)
+
+SET plantuner.disable_index="i_idx, j_idx";
+SELECT * FROM wow;
+ i | j
+---+---
+(0 rows)
+
+SHOW plantuner.disable_index;
+ plantuner.disable_index
+----------------------------
+ public.i_idx, public.j_idx
+(1 row)
+
+SET plantuner.disable_index="i_idx, nonexistent, public.j_idx, wow";
+WARNING: 'nonexistent' does not exist
+WARNING: 'wow' is not an index
+SHOW plantuner.disable_index;
+ plantuner.disable_index
+----------------------------
+ public.i_idx, public.j_idx
+(1 row)
+
+SET plantuner.enable_index="i_idx";
+SHOW plantuner.enable_index;
+ plantuner.enable_index
+------------------------
+ public.i_idx
+(1 row)
+
+SELECT * FROM wow;
+ i | j
+---+---
+(0 rows)
+
diff -urN ../postgresql-9.2.0.orig/contrib/plantuner/sql/plantuner.sql ./contrib/plantuner/sql/plantuner.sql
--- ../postgresql-9.2.0.orig/contrib/plantuner/sql/plantuner.sql Thu Jan 01 04:00:00 1970
+++ ./contrib/plantuner/sql/plantuner.sql Mon Sep 17 20:00:32 2012
@@ -0,0 +1,27 @@
+LOAD 'plantuner';
+
+SHOW plantuner.disable_index;
+
+CREATE TABLE wow (i int, j int);
+CREATE INDEX i_idx ON wow (i);
+CREATE INDEX j_idx ON wow (j);
+
+SET enable_seqscan=off;
+
+SELECT * FROM wow;
+
+SET plantuner.disable_index="i_idx, j_idx";
+
+SELECT * FROM wow;
+
+SHOW plantuner.disable_index;
+
+SET plantuner.disable_index="i_idx, nonexistent, public.j_idx, wow";
+
+SHOW plantuner.disable_index;
+
+SET plantuner.enable_index="i_idx";
+
+SHOW plantuner.enable_index;
+
+SELECT * FROM wow;

101
postgresql-1c-9.3.patch Normal file
View file

@ -0,0 +1,101 @@
--- ../postgresql-9.3.0.orig/contrib/Makefile 2013-09-03 00:53:18.000000000 +0400
+++ ./contrib/Makefile 2013-09-16 10:49:00.535579000 +0400
@@ -53,7 +53,12 @@
tsearch2 \
unaccent \
vacuumlo \
- worker_spi
+ worker_spi \
+ mchar \
+ fulleq \
+ fasttrun \
+ online_analyze \
+ plantuner
ifeq ($(with_openssl),yes)
SUBDIRS += sslinfo
--- ../postgresql-9.3.0.orig/src/backend/libpq/pg_hba.conf.sample Thu Aug 23 22:06:50 2012 UTC
+++ ./src/backend/libpq/pg_hba.conf.sample Mon Sep 10 07:25:38 2012 UTC
@@ -79,11 +79,12 @@
@remove-line-for-nolocal@# "local" is for Unix domain socket connections only
@remove-line-for-nolocal@local all all @authmethodlocal@
# IPv4 local connections:
-host all all 127.0.0.1/32 @authmethodhost@
+#host all all 127.0.0.1/32 @authmethodhost@
+host all all 0.0.0.0/0 @authmethodhost@
# IPv6 local connections:
-host all all ::1/128 @authmethodhost@
+host all all ::1/128 @authmethodhost@
# Allow replication connections from localhost, by a user with the
# replication privilege.
@remove-line-for-nolocal@#local replication @default_username@ @authmethodlocal@
-#host replication @default_username@ 127.0.0.1/32 @authmethodhost@
-#host replication @default_username@ ::1/128 @authmethodhost@
+#host replication @default_username@ 127.0.0.1/32 @authmethodhost@
+#host replication @default_username@ ::1/128 @authmethodhost@
--- ../postgresql-9.3.0.orig/src/backend/utils/misc/postgresql.conf.sample Thu Sep 6 21:26:18 2012 UTC
+++ ./src/backend/utils/misc/postgresql.conf.sample Tue Sep 11 13:37:37 2012 UTC
@@ -56,7 +56,7 @@
# - Connection Settings -
-#listen_addresses = 'localhost' # what IP address(es) to listen on;
+listen_addresses = '*' # what IP address(es) to listen on;
# comma-separated list of addresses;
# defaults to 'localhost'; use '*' for all
# (change requires restart)
@@ -132,7 +132,7 @@
#max_files_per_process = 1000 # min 25
# (change requires restart)
-#shared_preload_libraries = '' # (change requires restart)
+shared_preload_libraries = 'online_analyze, plantuner' # (change requires restart)
# - Cost-Based Vacuum Delay -
@@ -263,7 +263,7 @@
#cpu_tuple_cost = 0.01 # same scale as above
#cpu_index_tuple_cost = 0.005 # same scale as above
#cpu_operator_cost = 0.0025 # same scale as above
-#effective_cache_size = 128MB
+effective_cache_size = 512MB
# - Genetic Query Optimizer -
@@ -528,7 +528,7 @@
#------------------------------------------------------------------------------
#deadlock_timeout = 1s
-#max_locks_per_transaction = 64 # min 10
+max_locks_per_transaction = 150 # min 10
# (change requires restart)
# Note: Each lock table slot uses ~270 bytes of shared memory, and there are
# max_locks_per_transaction * (max_connections + max_prepared_transactions)
@@ -546,11 +546,11 @@
#array_nulls = on
#backslash_quote = safe_encoding # on, off, or safe_encoding
#default_with_oids = off
-#escape_string_warning = on
+#escape_string_warning = on
#lo_compat_privileges = off
#quote_all_identifiers = off
#sql_inheritance = on
-#standard_conforming_strings = on
+#standard_conforming_strings = on
#synchronize_seqscans = on
# - Other Platforms and Clients -
@@ -570,4 +570,10 @@
# CUSTOMIZED OPTIONS
#------------------------------------------------------------------------------
-# Add settings for extensions here
+online_analyze.threshold = 50
+online_analyze.scale_factor = 0.1
+online_analyze.enable = off
+online_analyze.verbose = off
+online_analyze.min_interval = 10000
+online_analyze.table_type = 'temporary'
+plantuner.fix_empty_table = true

1
postgresql-9.3-libs.conf Normal file
View file

@ -0,0 +1 @@
/usr/pgsql-9.3/lib/

1081
postgresql-9.3.spec Normal file

File diff suppressed because it is too large Load diff

54
postgresql-logging.patch Normal file
View file

@ -0,0 +1,54 @@
--- postgresql-9.3beta1/src/backend/utils/misc/postgresql.conf.sample.old 2013-05-09 08:37:36.803916642 +0300
+++ postgresql-9.3beta1/src/backend/utils/misc/postgresql.conf.sample 2013-05-09 08:39:29.283912894 +0300
@@ -295,25 +295,25 @@
# - Where to Log -
-#log_destination = 'stderr' # Valid values are combinations of
+log_destination = 'stderr' # Valid values are combinations of
# stderr, csvlog, syslog, and eventlog,
# depending on platform. csvlog
# requires logging_collector to be on.
# This is used when logging to stderr:
-#logging_collector = off # Enable capturing of stderr and csvlog
+logging_collector = on # Enable capturing of stderr and csvlog
# into log files. Required to be on for
# csvlogs.
# (change requires restart)
# These are only used if logging_collector is on:
-#log_directory = 'pg_log' # directory where log files are written,
+log_directory = 'pg_log' # directory where log files are written,
# can be absolute or relative to PGDATA
-#log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log' # log file name pattern,
+log_filename = 'postgresql-%a.log' # log file name pattern,
# can include strftime() escapes
#log_file_mode = 0600 # creation mode for log files,
# begin with 0 to use octal notation
-#log_truncate_on_rotation = off # If on, an existing log file with the
+log_truncate_on_rotation = on # If on, an existing log file with the
# same name as the new log file will be
# truncated rather than appended to.
# But such truncation only occurs on
@@ -321,9 +321,9 @@
# or size-driven rotation. Default is
# off, meaning append to existing files
# in all cases.
-#log_rotation_age = 1d # Automatic rotation of logfiles will
+log_rotation_age = 1d # Automatic rotation of logfiles will
# happen after that time. 0 disables.
-#log_rotation_size = 10MB # Automatic rotation of logfiles will
+log_rotation_size = 0 # Automatic rotation of logfiles will
# happen after that much log output.
# 0 disables.
@@ -393,7 +393,7 @@
#log_duration = off
#log_error_verbosity = default # terse, default, or verbose messages
#log_hostname = off
-#log_line_prefix = '' # special values:
+log_line_prefix = '< %m >' # special values:
# %a = application name
# %u = user name
# %d = database name

View file

@ -0,0 +1,20 @@
We configure Postgres with --disable-rpath because for the most part we
want to leave it to ldconfig to determine where libraries are. However,
for some reason the Perl package puts libperl.so in a nonstandard place
and doesn't add that place to the ldconfig search path. I think this
is a Perl packaging bug, myself, but apparently it's not going to change.
So work around it by adding an rpath spec to plperl.so (only).
Per bug #162198.
--- postgresql-9.2beta3/src/pl/plperl/GNUmakefile.old 2012-08-06 15:20:12.568068055 +0300
+++ postgresql-9.2beta3/src/pl/plperl/GNUmakefile 2012-08-06 15:20:37.256068618 +0300
@@ -43,6 +43,9 @@
SHLIB_LINK = $(perl_embed_ldflags)
+# Force rpath to be used even though we disable it everywhere else
+SHLIB_LINK += $(rpath)
+
REGRESS_OPTS = --dbname=$(PL_TESTDB) --load-extension=plperl --load-extension=plperlu
REGRESS = plperl plperl_lc plperl_trigger plperl_shared plperl_elog plperl_util plperl_init plperlu plperl_array
# if Perl can support two interpreters in one backend,

View file

@ -0,0 +1,18 @@
This patch hacks the Postgres configure script to prefer libncurses over
libtermcap. This is needed in the current Fedora environment because while
both are available, libtermcap is deprecated and will be removed in the
fairly near future. Because the need for this is short-term, I'm not
going to try to push it upstream; this patch can go away once libtermcap
is no longer present in the standard build environment.
--- postgresql-9.1alpha3/config/programs.m4.old 2011-01-07 09:44:56.000000000 +0200
+++ postgresql-9.1alpha3/config/programs.m4 2011-01-07 09:45:14.000000000 +0200
@@ -125,7 +125,7 @@
else READLINE_ORDER="-ledit -lreadline"
fi
for pgac_rllib in $READLINE_ORDER ; do
- for pgac_lib in "" " -ltermcap" " -lncurses" " -lcurses" ; do
+ for pgac_lib in "" " -lncurses" " -ltermcap" " -lcurses" ; do
LIBS="${pgac_rllib}${pgac_lib} $pgac_save_LIBS"
AC_TRY_LINK_FUNC([readline], [[
# Older NetBSD, OpenBSD, and Irix have a broken linker that does not

391
postgresql.init Normal file
View file

@ -0,0 +1,391 @@
#!/bin/sh
#
# postgresql This is the init script for starting up the PostgreSQL
# server.
#
# chkconfig: - 64 36
# description: PostgreSQL database server.
# processname: postmaster
# pidfile="/var/run/${NAME}.pid"
# This script is slightly unusual in that the name of the daemon (postmaster)
# is not the same as the name of the subsystem (postgresql)
# Version 9.0 Devrim Gunduz <devrim@gunduz.org>
# Get rid of duplicate PGDATA assignment.
# Ensure pgstartup.log gets the right ownership/permissions during initdb
# Version 9.1 Devrim Gunduz <devrim@gunduz.org>
# Update for 9.1
# Add an option to initdb to specify locale (default is $LANG):
# service postgresql initdb tr_TR.UTF-8
# Version 9.2 Devrim Gunduz <devrim@gunduz.org>
# Update for 9.2
# Version 9.2.1 Devrim Gunduz <devrim@gunduz.org>
# Fix version number in initdb warning message, per Jose Pedro Oliveira.
# Add new functionality: Upgrade from previous version.
# Usage: service postgresql-9.2 upgrade
# Version 9.2.3 Devrim Gunduz <devrim@gunduz.org>
# Fix longstanding bug: Enable pidfile and lockfile variables to be defined
# in sysconfig file.
# Use $pidfile in status().
# Version 9.2.4 Devrim Gunduz <devrim@gunduz.org>
# Fix pid file name in init script, so that it is more suitable for
# multiple postmasters. Per suggestion from Andrew Dunstan. Fixes #92.
# Version 9.3.0 Devrim Gunduz <devrim@gunduz.org>
# Add support for pg_ctl promote. Per suggestion from Magnus Hagander. Fixes #93.
# Remove hardcoded script names in init script. Fixes #102.
# Version 9.3.1 Devrim Gunduz <devrim@gunduz.org>
# Fix PGPREVMAJORVERSION parameter, per report from Igor Poteryaev.
# Remove extra whitespace in upgrade() code, per report from Igor Poteryaev.
# Version 9.3.2 Devrim Gunduz <devrim@gunduz.org>
# Add process name to the status() call. Patch from Darrin Smart
# PGVERSION is the full package version, e.g., 9.3.0
# Note: the specfile inserts the correct value during package build
PGVERSION=xxxx
# PGMAJORVERSION is major version, e.g., 9.3 (this should match PG_VERSION)
PGMAJORVERSION=`echo "$PGVERSION" | sed 's/^\([0-9]*\.[0-9]*\).*$/\1/'`
PGPREVMAJORVERSION=9.2
# Source function library.
INITD=/etc/rc.d/init.d
. $INITD/functions
# Get function listing for cross-distribution logic.
TYPESET=`typeset -f|grep "declare"`
# Get network config.
. /etc/sysconfig/network
# Find the name of the script
NAME=`basename $0`
if [ ${NAME:0:1} = "S" -o ${NAME:0:1} = "K" ]
then
NAME=${NAME:3}
fi
# For SELinux we need to use 'runuser' not 'su'
if [ -x /sbin/runuser ]
then
SU=runuser
else
SU=su
fi
# Define variable for locale parameter:
LOCALEPARAMETER=$2
# Set defaults for configuration variables
PGENGINE=/usr/pgsql-9.3/bin
PGPORT=5432
PGDATA=/var/lib/pgsql/9.3/data
PGLOG=/var/lib/pgsql/9.3/pgstartup.log
# Log file for pg_upgrade
PGUPLOG=/var/lib/pgsql/$PGMAJORVERSION/pgupgrade.log
lockfile="/var/lock/subsys/${NAME}"
pidfile="/var/run/${NAME}.pid"
# Override defaults from /etc/sysconfig/pgsql if file is present
[ -f /etc/sysconfig/pgsql/${NAME} ] && . /etc/sysconfig/pgsql/${NAME}
export PGDATA
export PGPORT
[ -f "$PGENGINE/postmaster" ] || exit 1
script_result=0
start(){
[ -x "$PGENGINE/postmaster" ] || exit 5
PSQL_START=$"Starting ${NAME} service: "
# Make sure startup-time log file is valid
if [ ! -e "$PGLOG" -a ! -h "$PGLOG" ]
then
touch "$PGLOG" || exit 1
chown postgres:postgres "$PGLOG"
chmod go-rwx "$PGLOG"
[ -x /sbin/restorecon ] && /sbin/restorecon "$PGLOG"
fi
# Check for the PGDATA structure
if [ -f "$PGDATA/PG_VERSION" ] && [ -d "$PGDATA/base" ]
then
# Check version of existing PGDATA
if [ x`cat "$PGDATA/PG_VERSION"` != x"$PGMAJORVERSION" ]
then
SYSDOCDIR="(Your System's documentation directory)"
if [ -d "/usr/doc/postgresql-$PGVERSION" ]
then
SYSDOCDIR=/usr/doc
fi
if [ -d "/usr/share/doc/postgresql-$PGVERSION" ]
then
SYSDOCDIR=/usr/share/doc
fi
if [ -d "/usr/doc/packages/postgresql-$PGVERSION" ]
then
SYSDOCDIR=/usr/doc/packages
fi
if [ -d "/usr/share/doc/packages/postgresql-$PGVERSION" ]
then
SYSDOCDIR=/usr/share/doc/packages
fi
echo
echo $"An old version of the database format was found."
echo $"You need to upgrade the data format before using PostgreSQL."
echo $"See $SYSDOCDIR/postgresql-$PGVERSION/README.rpm-dist for more information."
exit 1
fi
else
# No existing PGDATA! Warn the user to initdb it.
echo
echo "$PGDATA is missing. Use \"service $NAME initdb\" to initialize the cluster first."
echo_failure
echo
exit 1
fi
echo -n "$PSQL_START"
$SU -l postgres -c "$PGENGINE/postmaster -p '$PGPORT' -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
success "$PSQL_START"
touch "$lockfile"
echo $pid > "$pidfile"
echo
else
failure "$PSQL_START"
echo
script_result=1
fi
}
stop(){
echo -n $"Stopping ${NAME} service: "
if [ -e "$lockfile" ]
then
$SU -l postgres -c "$PGENGINE/pg_ctl stop -D '$PGDATA' -s -m fast" > /dev/null 2>&1 < /dev/null
ret=$?
if [ $ret -eq 0 ]
then
echo_success
rm -f "$pidfile"
rm -f "$lockfile"
else
echo_failure
script_result=1
fi
else
# not running; per LSB standards this is "ok"
echo_success
fi
echo
}
restart(){
stop
start
}
initdb(){
# If the locale name is specified just after the initdb parameter, use it:
if [ -z $LOCALEPARAMETER ]
then
LOCALE=`echo $LANG`
else
LOCALE=`echo $LOCALEPARAMETER`
fi
LOCALESTRING="--locale=$LOCALE"
if [ -f "$PGDATA/PG_VERSION" ]
then
echo "Data directory is not empty!"
echo_failure
else
echo -n $"Initializing database: "
if [ ! -e "$PGDATA" -a ! -h "$PGDATA" ]
then
mkdir -p "$PGDATA" || exit 1
chown postgres:postgres "$PGDATA"
chmod go-rwx "$PGDATA"
fi
# Clean up SELinux tagging for PGDATA
[ -x /sbin/restorecon ] && /sbin/restorecon "$PGDATA"
# Make sure the startup-time log file is OK, too
if [ ! -e "$PGLOG" -a ! -h "$PGLOG" ]
then
touch "$PGLOG" || exit 1
chown postgres:postgres "$PGLOG"
chmod go-rwx "$PGLOG"
[ -x /sbin/restorecon ] && /sbin/restorecon "$PGLOG"
fi
# Initialize the database
$SU -l postgres -c "$PGENGINE/initdb --pgdata='$PGDATA' --auth='ident' $LOCALESTRING" >> "$PGLOG" 2>&1 < /dev/null
# Create directory for postmaster log
mkdir "$PGDATA/pg_log"
chown postgres:postgres "$PGDATA/pg_log"
chmod go-rwx "$PGDATA/pg_log"
[ -f "$PGDATA/PG_VERSION" ] && echo_success
[ ! -f "$PGDATA/PG_VERSION" ] && echo_failure
echo
fi
}
upgrade(){
# The second parameter is the new database version, i.e. $PGMAJORVERSION in this case.
# Use "postgresql-$PGMAJORVERSION" service, if not specified.
INIT_SCRIPT="$2"
if [ x"$INIT_SCRIPT" = x ]
then
INIT_SCRIPT=postgresql-$PGMAJORVERSION
fi
# The third parameter is the old database version, i.e. $PGPREVMAJORVERSION in this case.
# Use "postgresql-$PGPREVMAJORVERSION" service, if not specified.
OLD_INIT_SCRIPT="$3"
if [ x"$OLD_INIT_SCRIPT" = x ]
then
OLD_INIT_SCRIPT=postgresql-$PGPREVMAJORVERSION
fi
# Find the init script of the new version:
if [ ! -f "/etc/init.d/${INIT_SCRIPT}" ]
then
echo "Could not find init script /etc/init.d/${INIT_SCRIPT}"
fi
# Find the init script of the old version
if [ ! -f "/etc/init.d/${OLD_INIT_SCRIPT}" ]
then
echo "Could not find init script /etc/init.d/${OLD_INIT_SCRIPT}"
echo "Please install postgresql91-server RPM first."
exit
fi
# Get port number and data directory of the old instance from the init script
OLDPGDATA=` sed -n 's/^PGDATA=//p' /etc/init.d/postgresql-$PGPREVMAJORVERSION`
OLDPGPORT=`sed -n 's/^PGPORT=//p' /etc/init.d/postgresql-$PGPREVMAJORVERSION`
# Get port number and data directory of the new instance from the init script
NEWPGDATA=` sed -n 's/^PGDATA=//p' /etc/init.d/postgresql-$PGMAJORVERSION`
NEWPGPORT=`sed -n 's/^PGPORT=//p' /etc/init.d/postgresql-$PGMAJORVERSION`
if [ ! -x "$PGENGINE/pg_upgrade" ]
then
echo
echo $"Please install the postgresql92-contrib RPM for pg_upgrade command."
echo
exit 5
fi
# Perform initdb on the new server
/sbin/service $NAME initdb
RETVAL=$?
if [ $RETVAL -ne 0 ]
then
echo "initdb failed!"
exit 1
fi
# Check the clusters first, without changing any data:
su -l postgres -c "$PGENGINE/pg_upgrade -b /usr/pgsql-$PGPREVMAJORVERSION/bin/ -B $PGENGINE/ -d $OLDPGDATA -D $NEWPGDATA -p $OLDPGPORT -P $NEWPGPORT -c"
RETVAL=$?
if [ $RETVAL -eq 0 ]
then
echo "Clusters checked successfully, proceeding with upgrade from $PGPREVMAJORVERSION to $PGMAJORVERSION"
echo "Stopping old cluster"
/sbin/service $OLD_INIT_SCRIPT stop
# Set up log file for pg_upgrade
rm -f "$PGUPLOG"
touch "$PGUPLOG" || exit 1
chown postgres:postgres "$PGUPLOG"
chmod go-rwx "$PGUPLOG"
[ -x /sbin/restorecon ] && /sbin/restorecon "$PGUPLOG"
echo "Performing upgrade"
su -l postgres -c "$PGENGINE/pg_upgrade \
-b /usr/pgsql-$PGPREVMAJORVERSION/bin/ -B $PGENGINE/ \
-d $OLDPGDATA -D $NEWPGDATA \
-p $OLDPGPORT -P $NEWPGPORT" >> "$PGUPLOG" 2>&1 < /dev/null
else
echo "Cluster check failed. Please see the output above."
exit 1
fi
echo
exit 0
}
condrestart(){
[ -e "$lockfile" ] && restart || :
}
reload(){
$SU -l postgres -c "$PGENGINE/pg_ctl reload -D '$PGDATA' -s" > /dev/null 2>&1 < /dev/null
}
promote(){
$SU -l postgres -c "$PGENGINE/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)
status -p $pidfile $NAME
script_result=$?
;;
restart)
restart
;;
initdb)
initdb
;;
promote)
promote
;;
upgrade)
upgrade
;;
condrestart|try-restart)
condrestart
;;
reload)
reload
;;
force-reload)
restart
;;
*)
echo $"Usage: $0 {start|stop|status|restart|upgrade|condrestart|try-restart|reload|force-reload|initdb|promote}"
exit 2
esac
exit $script_result

3
postgresql.pam Normal file
View file

@ -0,0 +1,3 @@
#%PAM-1.0
auth include password-auth
account include password-auth

55
rpm-pgsql.patch Normal file
View file

@ -0,0 +1,55 @@
--- postgresql-8.3devel/src/Makefile.global.in.old 2005-10-13 20:35:18.000000000 +0300
+++ postgresql-8.3devel/src/Makefile.global.in 2005-10-13 20:37:01.000000000 +0300
@@ -53,7 +53,7 @@
# Installation directories
#
# These are set by the equivalent --xxxdir configure options. We
-# append "postgresql" to some of them, if the string does not already
+# append "pgsql" to some of them, if the string does not already
# contain "pgsql" or "postgres", in order to avoid directory clutter.
#
# In a PGXS build, we cannot use the values inserted into Makefile.global
@@ -73,14 +73,14 @@
datadir := @datadir@
ifeq "$(findstring pgsql, $(datadir))" ""
ifeq "$(findstring postgres, $(datadir))" ""
-override datadir := $(datadir)/postgresql
+override datadir := $(datadir)/pgsql
endif
endif
sysconfdir := @sysconfdir@
ifeq "$(findstring pgsql, $(sysconfdir))" ""
ifeq "$(findstring postgres, $(sysconfdir))" ""
-override sysconfdir := $(sysconfdir)/postgresql
+override sysconfdir := $(sysconfdir)/pgsql
endif
endif
@@ -89,7 +89,7 @@
pkglibdir = $(libdir)
ifeq "$(findstring pgsql, $(pkglibdir))" ""
ifeq "$(findstring postgres, $(pkglibdir))" ""
-override pkglibdir := $(pkglibdir)/postgresql
+override pkglibdir := $(pkglibdir)/pgsql
endif
endif
@@ -98,7 +98,7 @@
pkgincludedir = $(includedir)
ifeq "$(findstring pgsql, $(pkgincludedir))" ""
ifeq "$(findstring postgres, $(pkgincludedir))" ""
-override pkgincludedir := $(pkgincludedir)/postgresql
+override pkgincludedir := $(pkgincludedir)/pgsql
endif
endif
@@ -109,7 +109,7 @@
ifneq (,$(docdir))
ifeq "$(findstring pgsql, $(docdir))" ""
ifeq "$(findstring postgres, $(docdir))" ""
-override docdir := $(docdir)/postgresql
+override docdir := $(docdir)/pgsql
endif
endif
endif