summaryrefslogtreecommitdiffstats
path: root/debian
diff options
context:
space:
mode:
Diffstat (limited to 'debian')
-rw-r--r--debian/changelog146
-rw-r--r--debian/clean11
-rw-r--r--debian/control300
-rw-r--r--debian/copyright270
-rw-r--r--debian/gitlab-ci.yml1
-rw-r--r--debian/libecpg-compat3.install1
-rw-r--r--debian/libecpg-compat3.symbols44
-rw-r--r--debian/libecpg-dev.install18
-rw-r--r--debian/libecpg6.install2
-rw-r--r--debian/libecpg6.symbols31
-rw-r--r--debian/libpgtypes3.install1
-rw-r--r--debian/libpgtypes3.symbols48
-rw-r--r--debian/libpq-dev.dirs1
-rw-r--r--debian/libpq-dev.install11
-rw-r--r--debian/libpq5.install2
-rw-r--r--debian/libpq5.symbols189
-rw-r--r--debian/patches/50-per-version-dirs.patch29
-rw-r--r--debian/patches/51-default-sockets-in-var.patch20
-rw-r--r--debian/patches/52-tutorial-README.patch16
-rw-r--r--debian/patches/53-pg_service.conf_directory_doc.patch19
-rw-r--r--debian/patches/54-debian-alternatives-for-external-tools.patch28
-rw-r--r--debian/patches/70-history13
-rw-r--r--debian/patches/autoconf2.697
-rw-r--r--debian/patches/extension_destdir270
-rw-r--r--debian/patches/filter-debug-prefix-map44
-rw-r--r--debian/patches/focal-arm64-outline-atomics23
-rw-r--r--debian/patches/hurd-iovec26
-rw-r--r--debian/patches/jit-s390x96
-rw-r--r--debian/patches/libpgport-pkglibdir91
-rw-r--r--debian/patches/pgstat-report-conflicts-immediately.patch37
-rw-r--r--debian/patches/series15
-rw-r--r--debian/patches/v8-0001-Fix-recovery-conflict-SIGUSR1-handling.patch557
-rw-r--r--debian/po/POTFILES.in1
-rw-r--r--debian/po/de.po37
-rw-r--r--debian/po/es.po58
-rw-r--r--debian/po/fr.po39
-rw-r--r--debian/po/it.po37
-rw-r--r--debian/po/nl.po40
-rw-r--r--debian/po/pt.po39
-rw-r--r--debian/po/pt_BR.po37
-rw-r--r--debian/po/ro.po50
-rw-r--r--debian/po/ru.po39
-rw-r--r--debian/po/sv.po36
-rw-r--r--debian/po/templates.pot33
-rwxr-xr-xdebian/postgresql-16.install57
-rw-r--r--debian/postgresql-16.lintian-overrides20
-rw-r--r--debian/postgresql-16.postinst13
-rw-r--r--debian/postgresql-16.postrm80
-rw-r--r--debian/postgresql-16.preinst18
-rw-r--r--debian/postgresql-16.prerm16
-rw-r--r--debian/postgresql-16.templates7
-rw-r--r--debian/postgresql-client-16.install45
-rw-r--r--debian/postgresql-client-16.lintian-overrides3
-rw-r--r--debian/postgresql-client-16.postinst13
-rw-r--r--debian/postgresql-client-16.prerm12
-rw-r--r--debian/postgresql-doc-16.doc-base18
-rw-r--r--debian/postgresql-doc-16.install2
-rw-r--r--debian/postgresql-doc-16.postinst30
-rw-r--r--debian/postgresql-doc-16.prerm17
-rwxr-xr-xdebian/postgresql-plperl-16.install6
l---------debian/postgresql-plperl-16.lintian-overrides1
-rwxr-xr-xdebian/postgresql-plpython3-16.install6
l---------debian/postgresql-plpython3-16.lintian-overrides1
-rw-r--r--debian/postgresql-pltcl-16.install3
l---------debian/postgresql-pltcl-16.lintian-overrides1
-rw-r--r--debian/postgresql-server-dev-16.install2
l---------debian/postgresql-server-dev-16.lintian-overrides1
-rwxr-xr-xdebian/rules5
-rw-r--r--debian/source/format1
-rw-r--r--debian/source/lintian-overrides4
-rw-r--r--debian/tests/Makefile.regress5
-rw-r--r--debian/tests/control21
-rwxr-xr-xdebian/tests/installcheck41
-rwxr-xr-xdebian/tests/run-testsuite5
-rw-r--r--debian/watch4
75 files changed, 3271 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..db6092b
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,146 @@
+postgresql-16 (16.2-1) unstable; urgency=medium
+
+ * New upstream version.
+
+ * Tighten security restrictions within REFRESH MATERIALIZED VIEW
+ CONCURRENTLY (Heikki Linnakangas)
+
+ One step of a concurrent refresh command was run under weak security
+ restrictions. If a materialized view's owner could persuade a superuser
+ or other high-privileged user to perform a concurrent refresh on that
+ view, the view's owner could control code executed with the privileges
+ of the user running REFRESH. Fix things so that all user-determined code
+ is run as the view's owner, as expected.
+
+ The only known exploit for this error does not work in PostgreSQL 16.0
+ and later, so it may be that v16 is not vulnerable in practice.
+
+ The PostgreSQL Project thanks Pedro Gallegos for reporting this problem.
+ (CVE-2024-0985)
+
+ * Add Swedish debconf translation by Martin Bagge and Anders Jonsson.
+ Thanks! (Closes: #1059170)
+
+ -- Christoph Berg <myon@debian.org> Tue, 06 Feb 2024 13:27:57 +0100
+
+postgresql-16 (16.1-1) unstable; urgency=medium
+
+ * New upstream version.
+
+ * Fix handling of unknown-type arguments in DISTINCT "any" aggregate
+ functions (Tom Lane)
+
+ This error led to a text-type value being interpreted as an unknown-type
+ value (that is, a zero-terminated string) at runtime. This could result
+ in disclosure of server memory following the text value.
+
+ The PostgreSQL Project thanks Jingzhou Fu for reporting this problem.
+ (CVE-2023-5868)
+
+ * Detect integer overflow while computing new array dimensions
+ (Tom Lane)
+
+ When assigning new elements to array subscripts that are outside the
+ current array bounds, an undetected integer overflow could occur in edge
+ cases. Memory stomps that are potentially exploitable for arbitrary
+ code execution are possible, and so is disclosure of server memory.
+
+ The PostgreSQL Project thanks Pedro Gallegos for reporting this problem.
+ (CVE-2023-5869)
+
+ * Prevent the pg_signal_backend role from signalling background workers
+ and autovacuum processes (Noah Misch, Jelte Fennema-Nio)
+
+ The documentation says that pg_signal_backend
+ cannot issue signals to superuser-owned processes. It was able to
+ signal these background processes, though, because they advertise a
+ role OID of zero. Treat that as indicating superuser ownership.
+ The security implications of cancelling one of these process types
+ are fairly small so far as the core code goes (we'll just start
+ another one), but extensions might add background workers that are
+ more vulnerable.
+
+ Also ensure that the is_superuser parameter is set correctly in such
+ processes. No specific security consequences are known for that
+ oversight, but it might be significant for some extensions.
+
+ The PostgreSQL Project thanks Hemanth Sandrana and Mahendrakar
+ Srinivasarao for reporting this problem. (CVE-2023-5870)
+
+ * Fix misbehavior during recursive page split in GiST index build
+ (Heikki Linnakangas)
+
+ Fix a case where the location of a page downlink was incorrectly
+ tracked, and introduce some logic to allow recovering from such
+ situations rather than silently doing the wrong thing. This error could
+ result in incorrect answers from subsequent index searches. It may be
+ advisable to reindex all GiST indexes after installing this update.
+
+ * Prevent de-duplication of btree index entries for interval columns
+
+ There are interval values that are distinguishable but compare equal,
+ for example 24:00:00 and 1 day. This breaks assumptions made by btree
+ de-duplication, so interval columns need to be excluded from
+ de-duplication. This oversight can cause incorrect results from
+ index-only scans. Moreover, after updating amcheck will report an error
+ for almost all such indexes. Users should reindex any btree indexes on
+ interval columns.
+
+ * Use default LLVM version; package is now compatible with LLVM 16.
+ * Rebase debian/patches/libpgport-pkglibdir.
+
+ -- Christoph Berg <myon@debian.org> Tue, 07 Nov 2023 14:18:31 +0100
+
+postgresql-16 (16.0-2) unstable; urgency=medium
+
+ * Use LLVM 15 for JIT support, 16 is not supported yet. (Closes: #1051881)
+
+ -- Christoph Berg <myon@debian.org> Thu, 14 Sep 2023 09:13:57 +0200
+
+postgresql-16 (16.0-1) unstable; urgency=medium
+
+ * First PostgreSQL 16 release.
+
+ -- Christoph Berg <myon@debian.org> Mon, 11 Sep 2023 22:41:53 +0200
+
+postgresql-16 (16~rc1-2) experimental; urgency=medium
+
+ * Disable jit on loong64; PG does not support LLVM 16 yet while LLVM
+ versions before 16 do not support loong64. (Closes: #1051385)
+ * Introduce build profile pkg.postgresql.nolibpkgs.
+ * Cherry-pick WIP patches to stabilize tests on s390x.
+
+ -- Christoph Berg <myon@debian.org> Thu, 07 Sep 2023 14:14:52 +0200
+
+postgresql-16 (16~rc1-1) experimental; urgency=medium
+
+ * New release candidate version.
+
+ -- Christoph Berg <myon@debian.org> Tue, 29 Aug 2023 15:58:19 +0200
+
+postgresql-16 (16~beta3-1) experimental; urgency=medium
+
+ * New beta version.
+ * Bump postgresql-common dependency to 252, required for alternatives.
+ * Test-Depend on tzdata-legacy | tzdata (<< 2023c-8).
+
+ -- Christoph Berg <myon@debian.org> Thu, 10 Aug 2023 13:57:07 +0200
+
+postgresql-16 (16~beta2-1) experimental; urgency=medium
+
+ * New beta version.
+
+ -- Christoph Berg <myon@debian.org> Wed, 28 Jun 2023 15:41:55 +0200
+
+postgresql-16 (16~beta1-2) experimental; urgency=medium
+
+ * Bump postgresql-common B-D to 250 to ignore test failures on alpha et al.
+ * Define IOV_MAX on hurd-i386.
+
+ -- Christoph Berg <myon@debian.org> Wed, 24 May 2023 11:11:53 +0200
+
+postgresql-16 (16~beta1-1) experimental; urgency=medium
+
+ * New major upstream version 16; packaging based on postgresql-15.
+
+ -- Christoph Berg <myon@debian.org> Tue, 23 May 2023 14:05:19 +0200
diff --git a/debian/clean b/debian/clean
new file mode 100644
index 0000000..27de16e
--- /dev/null
+++ b/debian/clean
@@ -0,0 +1,11 @@
+# force rebuild of errcodes.h and symlinks
+src/backend/utils/errcodes.h
+src/backend/utils/fmgr-stamp
+src/backend/utils/fmgroids.h
+src/backend/utils/fmgrprotos.h
+
+src/backend/snowball/snowball_create.sql
+
+# regression tests debris
+src/test/regress/regress.o
+src/test/regress/regress.so
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..839395b
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,300 @@
+Source: postgresql-16
+Section: database
+Priority: optional
+Maintainer: Debian PostgreSQL Maintainers <team+postgresql@tracker.debian.org>
+Uploaders:
+ Martin Pitt <mpitt@debian.org>,
+ Peter Eisentraut <petere@debian.org>,
+ Christoph Berg <myon@debian.org>,
+Standards-Version: 4.5.0
+Rules-Requires-Root: no
+Build-Depends:
+ autoconf,
+ bison,
+ clang [!alpha !hppa !hurd-i386 !ia64 !kfreebsd-amd64 !kfreebsd-i386 !loong64 !m68k !powerpc !riscv64 !sh4 !sparc64 !x32],
+ debhelper-compat (= 13),
+ dh-exec (>= 0.13~),
+ docbook-xml,
+ docbook-xsl (>= 1.77),
+ dpkg-dev (>= 1.16.1~),
+ flex,
+ gdb <!nocheck>,
+ gettext,
+ libicu-dev,
+ libio-pty-perl <!nocheck>,
+ libipc-run-perl <!nocheck>,
+ libkrb5-dev,
+ libldap2-dev,
+ liblz4-dev,
+ libpam0g-dev | libpam-dev,
+ libperl-dev,
+ libreadline-dev,
+ libselinux1-dev [linux-any],
+ libssl-dev,
+ libsystemd-dev [linux-any],
+ libxml2-dev,
+ libxml2-utils,
+ libxslt1-dev,
+ libzstd-dev (>= 1.4.0) <!pkg.postgresql.nozstd>,
+ llvm-dev [!alpha !hppa !hurd-i386 !ia64 !kfreebsd-amd64 !kfreebsd-i386 !loong64 !m68k !powerpc !riscv64 !sh4 !sparc64 !x32],
+ lz4 | liblz4-tool,
+ mawk,
+ perl (>= 5.8),
+ pkg-config,
+ postgresql-common (>= 252~),
+ python3-dev,
+ systemtap-sdt-dev,
+ tcl-dev,
+ tzdata <!nocheck>,
+ tzdata-legacy <!nocheck> | tzdata (<< 2023c-8) <!nocheck>,
+ uuid-dev,
+ xsltproc,
+ zlib1g-dev | libz-dev,
+ zstd (>= 1.4.0) <!pkg.postgresql.nozstd>,
+Homepage: http://www.postgresql.org/
+Vcs-Browser: https://salsa.debian.org/postgresql/postgresql
+Vcs-Git: https://salsa.debian.org/postgresql/postgresql.git -b 16
+
+Package: libpq-dev
+Build-Profiles: <!pkg.postgresql.nolibpkgs>
+Architecture: any
+Section: libdevel
+Depends:
+ libpq5 (= ${binary:Version}),
+ libssl-dev,
+ ${misc:Depends},
+ ${shlibs:Depends},
+Suggests:
+ postgresql-doc-16,
+Description: header files for libpq5 (PostgreSQL library)
+ Header files and static library for compiling C programs to link
+ with the libpq library in order to communicate with a PostgreSQL
+ database backend.
+ .
+ PostgreSQL is an object-relational SQL database management system.
+
+Package: libpq5
+Build-Profiles: <!pkg.postgresql.nolibpkgs>
+Architecture: any
+Section: libs
+Depends:
+ ${misc:Depends},
+ ${shlibs:Depends},
+Pre-Depends:
+ ${misc:Pre-Depends},
+Multi-Arch: same
+Description: PostgreSQL C client library
+ libpq is a C library that enables user programs to communicate with
+ the PostgreSQL database server. The server can be on another machine
+ and accessed through TCP/IP. This version of libpq is compatible
+ with servers from PostgreSQL 8.2 or later.
+ .
+ This package contains the run-time library, needed by packages using
+ libpq.
+ .
+ PostgreSQL is an object-relational SQL database management system.
+
+Package: libecpg6
+Build-Profiles: <!pkg.postgresql.nolibpkgs>
+Architecture: any
+Section: libs
+Depends:
+ ${misc:Depends},
+ ${shlibs:Depends},
+Pre-Depends:
+ ${misc:Pre-Depends},
+Multi-Arch: same
+Description: run-time library for ECPG programs
+ The libecpg shared library is used by programs built with ECPG
+ (Embedded PostgreSQL for C).
+ .
+ PostgreSQL is an object-relational SQL database management system.
+
+Package: libecpg-dev
+Build-Profiles: <!pkg.postgresql.nolibpkgs>
+Architecture: any
+Section: libdevel
+Depends:
+ libecpg-compat3 (= ${binary:Version}),
+ libecpg6 (= ${binary:Version}),
+ libpgtypes3 (= ${binary:Version}),
+ libpq-dev,
+ ${misc:Depends},
+ ${shlibs:Depends},
+Description: development files for ECPG (Embedded PostgreSQL for C)
+ This package contains the necessary files to build ECPG (Embedded
+ PostgreSQL for C) programs. It includes the development libraries
+ and the preprocessor program ecpg.
+ .
+ PostgreSQL is an object-relational SQL database management system.
+ .
+ Install this package if you want to write C programs with SQL statements
+ embedded in them (rather than run by an external process).
+
+Package: libecpg-compat3
+Build-Profiles: <!pkg.postgresql.nolibpkgs>
+Architecture: any
+Section: libs
+Depends:
+ ${misc:Depends},
+ ${shlibs:Depends},
+Pre-Depends:
+ ${misc:Pre-Depends},
+Multi-Arch: same
+Description: older version of run-time library for ECPG programs
+ The libecpg_compat shared library is used by programs built with ecpg.
+ (Embedded PostgreSQL for C).
+ .
+ PostgreSQL is an object-relational SQL database management system.
+
+Package: libpgtypes3
+Build-Profiles: <!pkg.postgresql.nolibpkgs>
+Architecture: any
+Section: libs
+Depends:
+ ${misc:Depends},
+ ${shlibs:Depends},
+Pre-Depends:
+ ${misc:Pre-Depends},
+Multi-Arch: same
+Description: shared library libpgtypes for PostgreSQL 16
+ The libpgtypes shared library is used by programs built with ecpg.
+ (Embedded PostgreSQL for C).
+ .
+ PostgreSQL is an object-relational SQL database management system.
+
+Package: postgresql-16
+Architecture: any
+Depends:
+ locales | locales-all,
+ postgresql-client-16,
+ postgresql-common (>= 252~),
+ ssl-cert,
+ tzdata,
+ ${misc:Depends},
+ ${shlibs:Depends},
+Provides:
+ postgresql-contrib-16,
+ postgresql-16-jit-llvm (= ${llvm:Version}) [!alpha !hppa !hurd-i386 !ia64 !kfreebsd-amd64 !kfreebsd-i386 !loong64 !m68k !powerpc !riscv64 !sh4 !sparc64 !x32],
+Recommends:
+ sysstat,
+Breaks:
+ dbconfig-common (<< 2.0.22~),
+Description: The World's Most Advanced Open Source Relational Database
+ PostgreSQL, also known as Postgres, is a free and open-source relational
+ database management system (RDBMS) emphasizing extensibility and SQL
+ compliance. It features transactions with Atomicity, Consistency, Isolation,
+ Durability (ACID) properties, automatically updatable views, materialized
+ views, triggers, foreign keys, and stored procedures. It is designed to handle
+ a range of workloads, from single machines to data warehouses or Web services
+ with many concurrent users.
+ .
+ This package provides the database server for PostgreSQL 16.${cassert}
+XB-Postgresql-Catversion: ${postgresql:Catversion}
+
+Package: postgresql-client-16
+Architecture: any
+Multi-Arch: foreign
+Depends:
+ libpq5 (>= ${source:Upstream-Version}),
+ postgresql-client-common (>= 182~),
+ sensible-utils,
+ ${misc:Depends},
+ ${shlibs:Depends},
+Suggests:
+ postgresql-16,
+ postgresql-doc-16,
+Provides:
+ postgresql-client,
+Description: front-end programs for PostgreSQL 16
+ This package contains client and administrative programs for
+ PostgreSQL: these are the interactive terminal client psql and
+ programs for creating and removing users and databases.
+ .
+ This is the client package for PostgreSQL 16. If you install
+ PostgreSQL 16 on a standalone machine, you need the server package
+ postgresql-16, too. On a network, you can install this package on
+ many client machines, while the server package may be installed on
+ only one machine.
+ .
+ PostgreSQL is an object-relational SQL database management system.
+
+Package: postgresql-server-dev-16
+Architecture: any
+Section: libdevel
+Depends:
+ clang-${llvm:Version} [!alpha !hppa !hurd-i386 !ia64 !kfreebsd-amd64 !kfreebsd-i386 !loong64 !m68k !powerpc !riscv64 !sh4 !sparc64 !x32],
+ libpq-dev (>= 16~~),
+ llvm-${llvm:Version}-dev [!alpha !hppa !hurd-i386 !ia64 !kfreebsd-amd64 !kfreebsd-i386 !loong64 !m68k !powerpc !riscv64 !sh4 !sparc64 !x32],
+ postgresql-client-16,
+ postgresql-common (>= 142~),
+ ${misc:Depends},
+ ${shlibs:Depends},
+Description: development files for PostgreSQL 16 server-side programming
+ Header files for compiling SSI code to link into PostgreSQL's backend; for
+ example, for C functions to be called from SQL.
+ .
+ This package also contains the Makefiles necessary for building add-on
+ modules of PostgreSQL, which would otherwise have to be built in the
+ PostgreSQL source-code tree.
+ .
+ PostgreSQL is an object-relational SQL database management system.
+
+Package: postgresql-doc-16
+Architecture: all
+Build-Profiles: <!nodoc>
+Multi-Arch: foreign
+Section: doc
+Depends:
+ ${misc:Depends},
+Description: documentation for the PostgreSQL database management system
+ This package contains all README files, user manual, and examples for
+ PostgreSQL 16. The manual is in HTML format.
+ .
+ PostgreSQL is an object-relational SQL database management system.
+
+Package: postgresql-plperl-16
+Architecture: any
+Depends:
+ perl,
+ postgresql-16 (= ${binary:Version}),
+ ${misc:Depends},
+ ${shlibs:Depends},
+Provides:
+ postgresql-plperl,
+Description: PL/Perl procedural language for PostgreSQL 16
+ PL/Perl enables an SQL developer to write procedural language functions
+ for PostgreSQL 16 in Perl. You need this package if you have any
+ PostgreSQL 16 functions that use the languages plperl or plperlu.
+ .
+ PostgreSQL is an object-relational SQL database management system.
+
+Package: postgresql-plpython3-16
+Architecture: any
+Depends:
+ postgresql-16 (= ${binary:Version}),
+ ${misc:Depends},
+ ${shlibs:Depends},
+Provides:
+ postgresql-plpython3,
+Description: PL/Python 3 procedural language for PostgreSQL 16
+ PL/Python 3 enables an SQL developer to write procedural language functions
+ for PostgreSQL 16 in Python 3. You need this package if you have any
+ PostgreSQL 16 functions that use the languages plpython3 or plpython3u.
+ .
+ PostgreSQL is an object-relational SQL database management system.
+
+Package: postgresql-pltcl-16
+Architecture: any
+Depends:
+ postgresql-16 (= ${binary:Version}),
+ ${misc:Depends},
+ ${shlibs:Depends},
+Provides:
+ postgresql-pltcl,
+Description: PL/Tcl procedural language for PostgreSQL 16
+ PL/Tcl enables an SQL developer to write procedural language functions
+ for PostgreSQL 16 in Tcl. You need this package if you have any
+ PostgreSQL 16 functions that use the languages pltcl or pltclu.
+ .
+ PostgreSQL is an object-relational SQL database management system.
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..df27d1f
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,270 @@
+Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: PostgreSQL
+Source: https://www.postgresql.org/ftp/source/
+
+### PostgreSQL copyrights ###
+
+Files: *
+Copyright: Portions Copyright (c) 1996-2019, PostgreSQL Global Development Group
+ Portions Copyright (c) 1994, The Regents of the University of California
+License: PostgreSQL
+
+Files: src/backend/regex/*
+Copyright:
+ Copyright (c) 2013-2022, PostgreSQL Global Development Group
+ Copyright (c) 1998, 1999 Henry Spencer. All rights reserved.
+ Copyright (c) 1998 Sun Microsystems, Inc.
+ Copyright (c) 1998, 1999 by Scriptics Corporation.
+License: PostgreSQL and Custom-regex and Tcl
+
+Files: src/bin/pg_dump/*
+Copyright: Portions Copyright (c) 2000, Philip Warner
+License: Custom-pg_dump
+ Rights are granted to use this software in any way so long as this notice is
+ not removed. The author is not responsible for loss or damages that may
+ result from its use.
+
+Files: src/backend/snowball/libstemmer/* src/include/snowball/libstemmer/*
+Copyright: Copyright (c) 2001, Dr Martin Porter,
+ Copyright (c) 2002, Richard Boulton.
+License: BSD-3-Clause
+Comment:
+ This module uses the word stemming code developed by the Snowball project,
+ http://snowballstem.org which is released by them under a BSD-style license.
+ Postgres' files under src/backend/snowball/libstemmer/ and
+ src/include/snowball/libstemmer/ are taken directly from the Snowball files,
+ with only some minor adjustments of file inclusions.
+ See src/backend/snowball/README for details.
+
+Files: src/backend/utils/mb/Unicode/*.txt
+Copyright: Copyright (C) 2001 earthian@tama.or.jp, All Rights Reserved.
+ Copyright (C) 2001 I'O, All Rights Reserved.
+ Copyright (C) 2006 Project X0213, All Rights Reserved.
+License: Custom-Unicode
+ You can use, modify, distribute this table freely.
+
+Files:
+ src/common/sha2.c
+ src/include/common/sha2.h
+Copyright: Copyright (c) 2000-2001, Aaron D. Gifford
+License: BSD-3-Clause
+
+### contrib copyrights ###
+
+Files: contrib/fuzzystrmatch/dmetaphone.c
+Copyright: Copyright 2000, Maurice Aubrey <maurice@hevanet.com>
+ Copyright 2003, North Carolina State Highway Patrol
+License: double-metaphone
+ This module is free software; you may redistribute it and/or
+ modify it under the same terms as Perl itself.
+ .
+ All rights reserved.
+ .
+ Permission to use, copy, modify, and distribute this software and its
+ documentation for any purpose, without fee, and without a written agreement
+ is hereby granted, provided that the above copyright notice and this
+ paragraph and the following two paragraphs appear in all copies.
+ .
+ IN NO EVENT SHALL THE NORTH CAROLINA STATE HIGHWAY PATROL BE LIABLE TO ANY
+ PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
+ INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
+ DOCUMENTATION, EVEN IF THE NORTH CAROLINA STATE HIGHWAY PATROL HAS BEEN
+ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ .
+ THE NORTH CAROLINA STATE HIGHWAY PATROL SPECIFICALLY DISCLAIMS ANY
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED
+ HEREUNDER IS ON AN "AS IS" BASIS, AND THE NORTH CAROLINA STATE HIGHWAY PATROL
+ HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
+ MODIFICATIONS.
+ .
+ The license of Perl is:
+ .
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of either:
+ .
+ a) the GNU General Public License as published by the Free Software
+ Foundation; either version 1, or (at your option) any later
+ version, or
+ .
+ b) the "Artistic License" which comes with Perl.
+ .
+ On Debian GNU/Linux systems, the complete text of the GNU General
+ Public License version 1 can be found in
+ `/usr/share/common-licenses/GPL-1' and the Artistic Licence in
+ `/usr/share/common-licenses/Artistic'.
+
+Files:
+ contrib/pageinspect/btreefuncs.c
+ contrib/pgrowlocks/*
+ contrib/pgstattuple/*
+Copyright: Copyright (c) 2006 Satoshi Nagayasu <nagayasus@nttdata.co.jp>
+ Copyright (c) 2001, 2002, 2005-2006 Tatsuo Ishii
+License: nagaysau-ishii
+ Permission to use, copy, modify, and distribute this software and
+ its documentation for any purpose, without fee, and without a
+ written agreement is hereby granted, provided that the above
+ copyright notice and this paragraph and the following two
+ paragraphs appear in all copies.
+ .
+ IN NO EVENT SHALL THE AUTHOR BE LIABLE TO ANY PARTY FOR DIRECT,
+ INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING
+ LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
+ DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED
+ OF THE POSSIBILITY OF SUCH DAMAGE.
+ .
+ THE AUTHOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS
+ IS" BASIS, AND THE AUTHOR HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE,
+ SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+Files:
+ contrib/pgcrypto/crypt-des.c
+Copyright: Copyright (c) 1994 David Burren
+ Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
+License: BSD-3-clause
+
+Files:
+ contrib/pgcrypto/mbuf.*
+ contrib/pgcrypto/openssl.c
+ contrib/pgcrypto/pgcrypto.*
+ contrib/pgcrypto/pgp*
+ contrib/pgcrypto/px*
+Copyright: Copyright (c) 2001, 2005 Marko Kreen
+License: BSD-2-clause
+ 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.
+ .
+ THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND 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 THE AUTHOR OR 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.
+
+### licenses ###
+
+License: PostgreSQL
+ Permission to use, copy, modify, and distribute this software and its
+ documentation for any purpose, without fee, and without a written agreement
+ is hereby granted, provided that the above copyright notice and this
+ paragraph and the following two paragraphs appear in all copies.
+ .
+ IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
+ DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING
+ LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
+ DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ .
+ THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
+ ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO
+ PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+License: BSD-3-Clause
+ 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 copyright holder nor the names of its contributors
+ may be used to endorse or promote products derived from this software without
+ specific prior written permission.
+ .
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT HOLDER OR 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.
+
+License: Custom-regex
+ Development of this software was funded, in part, by Cray Research Inc.,
+ UUNET Communications Services Inc., Sun Microsystems Inc., and Scriptics
+ Corporation, none of whom are responsible for the results. The author
+ thanks all of them.
+ .
+ Redistribution and use in source and binary forms -- with or without
+ modification -- are permitted for any purpose, provided that
+ redistributions in source form retain this entire copyright notice and
+ indicate the origin and nature of any modifications.
+ .
+ I'd appreciate being given credit for this package in the documentation
+ of software which uses it, but that is not a requirement.
+ .
+ THIS SOFTWARE IS PROVIDED ``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
+ HENRY SPENCER 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.
+
+License: Tcl
+ This software is copyrighted by the Regents of the University of
+ California, Sun Microsystems, Inc., Scriptics Corporation, ActiveState
+ Corporation and other parties. The following terms apply to all files
+ associated with the software unless explicitly disclaimed in
+ individual files.
+ .
+ The authors hereby grant permission to use, copy, modify, distribute,
+ and license this software and its documentation for any purpose, provided
+ that existing copyright notices are retained in all copies and that this
+ notice is included verbatim in any distributions. No written agreement,
+ license, or royalty fee is required for any of the authorized uses.
+ Modifications to this software may be copyrighted by their authors
+ and need not follow the licensing terms described here, provided that
+ the new terms are clearly indicated on the first page of each file where
+ they apply.
+ .
+ IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY
+ FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY
+ DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ .
+ THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE
+ IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE
+ NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
+ MODIFICATIONS.
+ .
+ GOVERNMENT USE: If you are acquiring this software on behalf of the
+ U.S. government, the Government shall have only "Restricted Rights"
+ in the software and related documentation as defined in the Federal
+ Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you
+ are acquiring the software on behalf of the Department of Defense, the
+ software shall be classified as "Commercial Computer Software" and the
+ Government shall have only "Restricted Rights" as defined in Clause
+ 252.227-7013 (c) (1) of DFARs. Notwithstanding the foregoing, the
+ authors grant the U.S. Government and others acting in its behalf
+ permission to use and distribute the software in accordance with the
+ terms specified in this license.
diff --git a/debian/gitlab-ci.yml b/debian/gitlab-ci.yml
new file mode 100644
index 0000000..67e4816
--- /dev/null
+++ b/debian/gitlab-ci.yml
@@ -0,0 +1 @@
+include: https://salsa.debian.org/postgresql/postgresql-common/raw/master/gitlab/gitlab-ci.yml
diff --git a/debian/libecpg-compat3.install b/debian/libecpg-compat3.install
new file mode 100644
index 0000000..c69d50d
--- /dev/null
+++ b/debian/libecpg-compat3.install
@@ -0,0 +1 @@
+usr/lib/*/libecpg_compat.so.3*
diff --git a/debian/libecpg-compat3.symbols b/debian/libecpg-compat3.symbols
new file mode 100644
index 0000000..3bd41e0
--- /dev/null
+++ b/debian/libecpg-compat3.symbols
@@ -0,0 +1,44 @@
+libecpg_compat.so.3 libecpg-compat3 #MINVER#
+* Build-Depends-Package: libecpg-dev
+ ECPG_informix_get_var@Base 0
+ ECPG_informix_reset_sqlca@Base 9.0~
+ ECPG_informix_set_var@Base 0
+ byleng@Base 0
+ decadd@Base 0
+ deccmp@Base 0
+ deccopy@Base 0
+ deccvasc@Base 0
+ deccvdbl@Base 0
+ deccvint@Base 0
+ deccvlong@Base 0
+ decdiv@Base 0
+ decmul@Base 0
+ decsub@Base 0
+ dectoasc@Base 0
+ dectodbl@Base 0
+ dectoint@Base 0
+ dectolong@Base 0
+ dtcurrent@Base 0
+ dtcvasc@Base 0
+ dtcvfmtasc@Base 0
+ dtsub@Base 0
+ dttoasc@Base 0
+ dttofmtasc@Base 0
+ intoasc@Base 0
+ ldchar@Base 0
+ rdatestr@Base 0
+ rdayofweek@Base 0
+ rdefmtdate@Base 0
+ rfmtdate@Base 0
+ rfmtlong@Base 0
+ rgetmsg@Base 0
+ risnull@Base 0
+ rjulmdy@Base 0
+ rmdyjul@Base 0
+ rsetnull@Base 0
+ rstrdate@Base 0
+ rtoday@Base 0
+ rtypalign@Base 0
+ rtypmsize@Base 0
+ rtypwidth@Base 0
+ rupshift@Base 0
diff --git a/debian/libecpg-dev.install b/debian/libecpg-dev.install
new file mode 100644
index 0000000..1935a0d
--- /dev/null
+++ b/debian/libecpg-dev.install
@@ -0,0 +1,18 @@
+usr/include/postgresql/ecpg*.h
+usr/include/postgresql/informix/*
+usr/include/postgresql/pgtypes*.h
+usr/include/postgresql/sql3types.h
+usr/include/postgresql/sqlca.h
+usr/include/postgresql/sqlda*.h
+usr/lib/*/libecpg.a
+usr/lib/*/libecpg.so
+usr/lib/*/libecpg_compat.a
+usr/lib/*/libecpg_compat.so
+usr/lib/*/libpgtypes.a
+usr/lib/*/libpgtypes.so
+usr/lib/*/pkgconfig/libecpg.pc
+usr/lib/*/pkgconfig/libecpg_compat.pc
+usr/lib/*/pkgconfig/libpgtypes.pc
+usr/lib/postgresql/*/bin/ecpg usr/bin
+usr/share/locale/*/*/ecpg-*.mo
+usr/share/postgresql/*/man/man1/ecpg.1* /usr/share/man/man1
diff --git a/debian/libecpg6.install b/debian/libecpg6.install
new file mode 100644
index 0000000..8ec1cee
--- /dev/null
+++ b/debian/libecpg6.install
@@ -0,0 +1,2 @@
+usr/lib/*/libecpg.so.6*
+usr/share/locale/*/*/ecpglib*.mo
diff --git a/debian/libecpg6.symbols b/debian/libecpg6.symbols
new file mode 100644
index 0000000..d20881a
--- /dev/null
+++ b/debian/libecpg6.symbols
@@ -0,0 +1,31 @@
+libecpg.so.6 libecpg6 #MINVER#
+* Build-Depends-Package: libecpg-dev
+ ECPGallocate_desc@Base 0
+ ECPGconnect@Base 0
+ ECPGdeallocate@Base 0
+ ECPGdeallocate_all@Base 0
+ ECPGdeallocate_desc@Base 0
+ ECPGdebug@Base 0
+ ECPGdescribe@Base 0
+ ECPGdisconnect@Base 0
+ ECPGdo@Base 0
+ ECPGdo_descriptor@Base 0
+ ECPGfree_auto_mem@Base 0
+ ECPGget_PGconn@Base 8.3.1-2~
+ ECPGget_desc@Base 0
+ ECPGget_desc_header@Base 0
+ ECPGget_sqlca@Base 0
+ ECPGget_var@Base 9.0~
+ ECPGis_noind_null@Base 0
+ ECPGprepare@Base 0
+ ECPGprepared_statement@Base 0
+ ECPGset_desc@Base 0
+ ECPGset_desc_header@Base 0
+ ECPGset_noind_null@Base 0
+ ECPGset_var@Base 9.0~
+ ECPGsetcommit@Base 0
+ ECPGsetconn@Base 0
+ ECPGstatus@Base 0
+ ECPGtrans@Base 0
+ ECPGtransactionStatus@Base 9.0~
+ sqlprint@Base 0
diff --git a/debian/libpgtypes3.install b/debian/libpgtypes3.install
new file mode 100644
index 0000000..decf90a
--- /dev/null
+++ b/debian/libpgtypes3.install
@@ -0,0 +1 @@
+usr/lib/*/libpgtypes.so.3*
diff --git a/debian/libpgtypes3.symbols b/debian/libpgtypes3.symbols
new file mode 100644
index 0000000..a398be3
--- /dev/null
+++ b/debian/libpgtypes3.symbols
@@ -0,0 +1,48 @@
+libpgtypes.so.3 libpgtypes3 #MINVER#
+* Build-Depends-Package: libecpg-dev
+ PGTYPESchar_free@Base 11~beta2
+ PGTYPESdate_dayofweek@Base 0
+ PGTYPESdate_defmt_asc@Base 0
+ PGTYPESdate_fmt_asc@Base 0
+ PGTYPESdate_free@Base 0
+ PGTYPESdate_from_asc@Base 0
+ PGTYPESdate_from_timestamp@Base 0
+ PGTYPESdate_julmdy@Base 0
+ PGTYPESdate_mdyjul@Base 0
+ PGTYPESdate_new@Base 0
+ PGTYPESdate_to_asc@Base 0
+ PGTYPESdate_today@Base 0
+ PGTYPESdecimal_free@Base 0
+ PGTYPESdecimal_new@Base 0
+ PGTYPESinterval_copy@Base 0
+ PGTYPESinterval_free@Base 0
+ PGTYPESinterval_from_asc@Base 0
+ PGTYPESinterval_new@Base 0
+ PGTYPESinterval_to_asc@Base 0
+ PGTYPESnumeric_add@Base 0
+ PGTYPESnumeric_cmp@Base 0
+ PGTYPESnumeric_copy@Base 0
+ PGTYPESnumeric_div@Base 0
+ PGTYPESnumeric_free@Base 0
+ PGTYPESnumeric_from_asc@Base 0
+ PGTYPESnumeric_from_decimal@Base 0
+ PGTYPESnumeric_from_double@Base 0
+ PGTYPESnumeric_from_int@Base 0
+ PGTYPESnumeric_from_long@Base 0
+ PGTYPESnumeric_mul@Base 0
+ PGTYPESnumeric_new@Base 0
+ PGTYPESnumeric_sub@Base 0
+ PGTYPESnumeric_to_asc@Base 0
+ PGTYPESnumeric_to_decimal@Base 0
+ PGTYPESnumeric_to_double@Base 0
+ PGTYPESnumeric_to_int@Base 0
+ PGTYPESnumeric_to_long@Base 0
+ PGTYPEStimestamp_add_interval@Base 0
+ PGTYPEStimestamp_current@Base 0
+ PGTYPEStimestamp_defmt_asc@Base 0
+ PGTYPEStimestamp_defmt_scan@Base 0
+ PGTYPEStimestamp_fmt_asc@Base 0
+ PGTYPEStimestamp_from_asc@Base 0
+ PGTYPEStimestamp_sub@Base 0
+ PGTYPEStimestamp_sub_interval@Base 0
+ PGTYPEStimestamp_to_asc@Base 0
diff --git a/debian/libpq-dev.dirs b/debian/libpq-dev.dirs
new file mode 100644
index 0000000..e772481
--- /dev/null
+++ b/debian/libpq-dev.dirs
@@ -0,0 +1 @@
+usr/bin
diff --git a/debian/libpq-dev.install b/debian/libpq-dev.install
new file mode 100644
index 0000000..734cb6f
--- /dev/null
+++ b/debian/libpq-dev.install
@@ -0,0 +1,11 @@
+usr/include/postgresql/internal/*
+usr/include/postgresql/libpq-events.h
+usr/include/postgresql/libpq-fe.h
+usr/include/postgresql/libpq/libpq-fs.h
+usr/include/postgresql/pg_config*.h
+usr/include/postgresql/postgres_ext.h
+usr/lib/*/libpq.a
+usr/lib/*/libpq.so
+usr/lib/*/pkgconfig/libpq.pc
+# pg_config manpage for both the perl and C versions
+usr/share/postgresql/*/man/man1/pg_config.1* /usr/share/man/man1
diff --git a/debian/libpq5.install b/debian/libpq5.install
new file mode 100644
index 0000000..c9811d7
--- /dev/null
+++ b/debian/libpq5.install
@@ -0,0 +1,2 @@
+usr/lib/*/libpq.so.5*
+usr/share/locale/*/LC_MESSAGES/libpq*.mo
diff --git a/debian/libpq5.symbols b/debian/libpq5.symbols
new file mode 100644
index 0000000..0490fcb
--- /dev/null
+++ b/debian/libpq5.symbols
@@ -0,0 +1,189 @@
+libpq.so.5 libpq5 #MINVER#
+* Build-Depends-Package: libpq-dev
+ PQbackendPID@Base 0
+ PQbinaryTuples@Base 0
+ PQcancel@Base 0
+ PQclear@Base 0
+ PQclientEncoding@Base 0
+ PQcmdStatus@Base 0
+ PQcmdTuples@Base 0
+ PQconndefaults@Base 0
+ PQconnectPoll@Base 0
+ PQconnectStart@Base 0
+ PQconnectStartParams@Base 9.0~
+ PQconnectdb@Base 0
+ PQconnectdbParams@Base 9.0~
+ PQconnectionNeedsPassword@Base 8.3~rc1-1~
+ PQconnectionUsedGSSAPI@Base 16~~
+ PQconnectionUsedPassword@Base 8.3~
+ PQconninfo@Base 9.3~
+ PQconninfoFree@Base 0
+ PQconninfoParse@Base 8.4~
+ PQconsumeInput@Base 0
+ PQcopyResult@Base 8.4~
+ PQdb@Base 0
+ PQdefaultSSLKeyPassHook_OpenSSL@Base 13~~
+ PQdescribePortal@Base 0
+ PQdescribePrepared@Base 0
+ PQdisplayTuples@Base 0
+ PQdsplen@Base 0
+ PQencryptPassword@Base 0
+ PQencryptPasswordConn@Base 10~~
+ PQendcopy@Base 0
+ PQenterPipelineMode@Base 14~~
+ PQenv2encoding@Base 0
+ PQerrorMessage@Base 0
+ PQescapeBytea@Base 0
+ PQescapeByteaConn@Base 0
+ PQescapeIdentifier@Base 9.0~
+ PQescapeLiteral@Base 9.0~
+ PQescapeString@Base 0
+ PQescapeStringConn@Base 0
+ PQexec@Base 0
+ PQexecParams@Base 0
+ PQexecPrepared@Base 0
+ PQexitPipelineMode@Base 14~~
+ PQfformat@Base 0
+ PQfinish@Base 0
+ PQfireResultCreateEvents@Base 8.4~
+ PQflush@Base 0
+ PQfmod@Base 0
+ PQfn@Base 0
+ PQfname@Base 0
+ PQfnumber@Base 0
+ PQfreeCancel@Base 0
+ PQfreeNotify@Base 0
+ PQfreemem@Base 0
+ PQfsize@Base 0
+ PQftable@Base 0
+ PQftablecol@Base 0
+ PQftype@Base 0
+ PQgetCancel@Base 0
+ PQgetCopyData@Base 0
+ PQgetResult@Base 0
+ PQgetSSLKeyPassHook_OpenSSL@Base 13~~
+ PQgetgssctx@Base 12~~
+ PQgetisnull@Base 0
+ PQgetlength@Base 0
+ PQgetline@Base 0
+ PQgetlineAsync@Base 0
+ PQgetssl@Base 0
+ PQgetvalue@Base 0
+ PQgssEncInUse@Base 12~~
+ PQhost@Base 0
+ PQhostaddr@Base 12~~
+ PQinitOpenSSL@Base 8.4~
+ PQinitSSL@Base 0
+ PQinstanceData@Base 8.4~
+ PQisBusy@Base 0
+ PQisnonblocking@Base 0
+ PQisthreadsafe@Base 0
+ PQlibVersion@Base 9.1~
+ PQmakeEmptyPGresult@Base 0
+ PQmblen@Base 0
+ PQmblenBounded@Base 14~beta2
+ PQnfields@Base 0
+ PQnotifies@Base 0
+ PQnparams@Base 0
+ PQntuples@Base 0
+ PQoidStatus@Base 0
+ PQoidValue@Base 0
+ PQoptions@Base 0
+ PQparameterStatus@Base 0
+ PQparamtype@Base 0
+ PQpass@Base 0
+ PQping@Base 9.1~
+ PQpingParams@Base 9.1~
+ PQpipelineStatus@Base 14~~
+ PQpipelineSync@Base 14~~
+ PQport@Base 0
+ PQprepare@Base 0
+ PQprint@Base 0
+ PQprintTuples@Base 0
+ PQprotocolVersion@Base 0
+ PQputCopyData@Base 0
+ PQputCopyEnd@Base 0
+ PQputline@Base 0
+ PQputnbytes@Base 0
+ PQregisterEventProc@Base 8.4~
+ PQregisterThreadLock@Base 0
+ PQrequestCancel@Base 0
+ PQresStatus@Base 0
+ PQreset@Base 0
+ PQresetPoll@Base 0
+ PQresetStart@Base 0
+ PQresultAlloc@Base 8.4~
+ PQresultErrorField@Base 0
+ PQresultErrorMessage@Base 0
+ PQresultInstanceData@Base 8.4~
+ PQresultMemorySize@Base 12~~
+ PQresultSetInstanceData@Base 8.4~
+ PQresultStatus@Base 0
+ PQresultVerboseErrorMessage@Base 9.6~~
+ PQsendDescribePortal@Base 0
+ PQsendDescribePrepared@Base 0
+ PQsendFlushRequest@Base 15~~
+ PQsendPrepare@Base 0
+ PQsendQuery@Base 0
+ PQsendQueryParams@Base 0
+ PQsendQueryPrepared@Base 0
+ PQserverVersion@Base 0
+ PQsetClientEncoding@Base 0
+ PQsetErrorContextVisibility@Base 9.6~~
+ PQsetErrorVerbosity@Base 0
+ PQsetInstanceData@Base 8.4~
+ PQsetNoticeProcessor@Base 0
+ PQsetNoticeReceiver@Base 0
+ PQsetResultAttrs@Base 8.4~
+ PQsetSSLKeyPassHook_OpenSSL@Base 13~~
+ PQsetSingleRowMode@Base 9.2~beta3
+ PQsetTraceFlags@Base 14~beta2
+ PQsetdbLogin@Base 0
+ PQsetnonblocking@Base 0
+ PQsetvalue@Base 8.4~
+ PQsocket@Base 0
+ PQsslAttribute@Base 9.5~~
+ PQsslAttributeNames@Base 9.5~~
+ PQsslInUse@Base 9.5~~
+ PQsslStruct@Base 9.5~~
+ PQstatus@Base 0
+ PQtrace@Base 0
+ PQtransactionStatus@Base 0
+ PQtty@Base 0
+ PQunescapeBytea@Base 0
+ PQuntrace@Base 0
+ PQuser@Base 0
+ appendBinaryPQExpBuffer@Base 0
+ appendPQExpBuffer@Base 0
+ appendPQExpBufferChar@Base 0
+ appendPQExpBufferStr@Base 0
+ createPQExpBuffer@Base 0
+ destroyPQExpBuffer@Base 0
+ enlargePQExpBuffer@Base 0
+ initPQExpBuffer@Base 0
+ lo_close@Base 0
+ lo_creat@Base 0
+ lo_create@Base 0
+ lo_export@Base 0
+ lo_import@Base 0
+ lo_import_with_oid@Base 8.4~
+ lo_lseek64@Base 9.3~
+ lo_lseek@Base 0
+ lo_open@Base 0
+ lo_read@Base 0
+ lo_tell64@Base 9.3~
+ lo_tell@Base 0
+ lo_truncate64@Base 9.3~
+ lo_truncate@Base 8.3~
+ lo_unlink@Base 0
+ lo_write@Base 0
+ pg_char_to_encoding@Base 0
+ pg_encoding_to_char@Base 0
+ pg_utf_mblen@Base 0
+ pg_valid_server_encoding@Base 0
+ pg_valid_server_encoding_id@Base 8.3~beta1-2~
+ pgresStatus@Base 0
+ pqsignal@Base 0
+ printfPQExpBuffer@Base 0
+ resetPQExpBuffer@Base 0
+ termPQExpBuffer@Base 0
diff --git a/debian/patches/50-per-version-dirs.patch b/debian/patches/50-per-version-dirs.patch
new file mode 100644
index 0000000..8277cdb
--- /dev/null
+++ b/debian/patches/50-per-version-dirs.patch
@@ -0,0 +1,29 @@
+Author: Martin Pitt <mpitt@debian.org>
+Description: Use version specific installation directories so that several major versions can be installed in parallel.
+Forwarded: No, Debian specific packaging with postgresql-common
+
+ * Install lib files into /usr/lib/postgresql/<version>/lib/
+ * Install server related header files into /usr/include/postgresql/<version>/server/
+
+Bug-Debian: http://bugs.debian.org/462037
+
+--- a/src/Makefile.global.in
++++ b/src/Makefile.global.in
+@@ -119,7 +119,7 @@ libdir := @libdir@
+ pkglibdir = $(libdir)
+ ifeq "$(findstring pgsql, $(pkglibdir))" ""
+ ifeq "$(findstring postgres, $(pkglibdir))" ""
+-override pkglibdir := $(pkglibdir)/postgresql
++override pkglibdir := /usr/lib/postgresql/@PG_MAJORVERSION@/lib
+ endif
+ endif
+
+@@ -167,7 +167,7 @@ endif # PGXS
+
+ # These derived path variables aren't separately configurable.
+
+-includedir_server = $(pkgincludedir)/server
++includedir_server = $(pkgincludedir)/@PG_MAJORVERSION@/server
+ includedir_internal = $(pkgincludedir)/internal
+ pgxsdir = $(pkglibdir)/pgxs
+ bitcodedir = $(pkglibdir)/bitcode
diff --git a/debian/patches/51-default-sockets-in-var.patch b/debian/patches/51-default-sockets-in-var.patch
new file mode 100644
index 0000000..9da49b8
--- /dev/null
+++ b/debian/patches/51-default-sockets-in-var.patch
@@ -0,0 +1,20 @@
+Author: Martin Pitt <mpitt@debian.org>
+Description: Put server Unix sockets into /var/run/postgresql/ by default
+Forwarded: No, Debian specific configuration with postgresql-common
+
+Using /tmp for sockets allows everyone to spoof a PostgreSQL server. Thus use
+/var/run/postgresql/ for "system" clusters which run as 'postgres' (user
+clusters will still use /tmp). Since system cluster are by far the common case,
+set it as default.
+
+--- a/src/include/pg_config_manual.h
++++ b/src/include/pg_config_manual.h
+@@ -206,7 +206,7 @@
+ * support them yet.
+ */
+ #ifndef WIN32
+-#define DEFAULT_PGSOCKET_DIR "/tmp"
++#define DEFAULT_PGSOCKET_DIR "/var/run/postgresql"
+ #else
+ #define DEFAULT_PGSOCKET_DIR ""
+ #endif
diff --git a/debian/patches/52-tutorial-README.patch b/debian/patches/52-tutorial-README.patch
new file mode 100644
index 0000000..9eb3263
--- /dev/null
+++ b/debian/patches/52-tutorial-README.patch
@@ -0,0 +1,16 @@
+Author: Martin Pitt <mpitt@debian.org>
+Description: Update tutorial README for required build dependencies.
+Forwarded: No, Debian specific
+
+--- a/src/tutorial/README
++++ b/src/tutorial/README
+@@ -6,8 +6,7 @@ tutorial
+ This directory contains SQL tutorial scripts. To look at them, first do a
+ % make
+ to compile all the scripts and C files for the user-defined functions
+-and types. (make needs to be GNU make --- it may be named something
+-different on your system, often 'gmake')
++and types. This requires a postgresql-server-dev-* package to be installed.
+
+ Then, run psql with the -s (single-step) flag:
+ % psql -s
diff --git a/debian/patches/53-pg_service.conf_directory_doc.patch b/debian/patches/53-pg_service.conf_directory_doc.patch
new file mode 100644
index 0000000..584b41c
--- /dev/null
+++ b/debian/patches/53-pg_service.conf_directory_doc.patch
@@ -0,0 +1,19 @@
+Author: Martin Pitt <mpitt@debian.org>
+Description: Update pg_service.conf example to tell the Debian specific file location.
+Forwarded: No, Debian specific
+
+Index: postgresql-9.2-9.2~beta1/src/interfaces/libpq/pg_service.conf.sample
+===================================================================
+--- postgresql-9.2-9.2~beta1.orig/src/interfaces/libpq/pg_service.conf.sample 2011-04-27 23:17:22.000000000 +0200
++++ postgresql-9.2-9.2~beta1/src/interfaces/libpq/pg_service.conf.sample 2011-05-10 11:25:42.151949794 +0200
+@@ -8,8 +8,8 @@
+ # to look up such parameters. A sample configuration for postgres is
+ # included in this file. Lines beginning with '#' are comments.
+ #
+-# Copy this to your sysconf directory (typically /usr/local/pgsql/etc) and
+-# rename it pg_service.conf.
++# Copy this to /etc/postgresql-common/ (or select its location with the
++# PGSYSCONFDIR environment variable) and rename it pg_service.conf.
+ #
+ #
+ #[postgres]
diff --git a/debian/patches/54-debian-alternatives-for-external-tools.patch b/debian/patches/54-debian-alternatives-for-external-tools.patch
new file mode 100644
index 0000000..0031989
--- /dev/null
+++ b/debian/patches/54-debian-alternatives-for-external-tools.patch
@@ -0,0 +1,28 @@
+Author: Martin Pitt <mpitt@debian.org>
+Description: Use Debian alternatives for external tools instead of hardcoded programs
+Forwarded: No, Debian specific
+
+--- a/src/bin/psql/settings.h
++++ b/src/bin/psql/settings.h
+@@ -19,8 +19,8 @@
+ #define DEFAULT_EDITOR "notepad.exe"
+ /* no DEFAULT_EDITOR_LINENUMBER_ARG for Notepad */
+ #else
+-#define DEFAULT_EDITOR "vi"
+-#define DEFAULT_EDITOR_LINENUMBER_ARG "+"
++#define DEFAULT_EDITOR "sensible-editor"
++/*#define DEFAULT_EDITOR_LINENUMBER_ARG "+"*/
+ #endif
+
+ #define DEFAULT_PROMPT1 "%/%R%x%# "
+--- a/src/include/fe_utils/print.h
++++ b/src/include/fe_utils/print.h
+@@ -20,7 +20,7 @@
+
+ /* This is not a particularly great place for this ... */
+ #ifndef __CYGWIN__
+-#define DEFAULT_PAGER "more"
++#define DEFAULT_PAGER "pager"
+ #else
+ #define DEFAULT_PAGER "less"
+ #endif
diff --git a/debian/patches/70-history b/debian/patches/70-history
new file mode 100644
index 0000000..34c8683
--- /dev/null
+++ b/debian/patches/70-history
@@ -0,0 +1,13 @@
+Author: Christoph Berg <myon@debian.org>
+Description: Document Debian location of release notes files.
+Forwarded: No, Debian specific
+
+--- a/HISTORY
++++ b/HISTORY
+@@ -3,3 +3,6 @@
+
+ Distribution file sets include release notes for their version and preceding
+ versions. Visit the file doc/src/sgml/html/release.html in an HTML browser.
++
++On Debian systems, the release notes are contained in the postgresql-doc-*
++packages, located in /usr/share/doc/postgresql-doc-*/html/release.html.
diff --git a/debian/patches/autoconf2.69 b/debian/patches/autoconf2.69
new file mode 100644
index 0000000..429044e
--- /dev/null
+++ b/debian/patches/autoconf2.69
@@ -0,0 +1,7 @@
+--- a/configure.ac
++++ b/configure.ac
+@@ -22,4 +21,0 @@ AC_INIT([PostgreSQL], [15devel], [pgsql-
+-m4_if(m4_defn([m4_PACKAGE_VERSION]), [2.69], [], [m4_fatal([Autoconf version 2.69 is required.
+-Untested combinations of 'autoconf' and PostgreSQL versions are not
+-recommended. You can remove the check from 'configure.ac' but it is then
+-your responsibility whether the result works or not.])])
diff --git a/debian/patches/extension_destdir b/debian/patches/extension_destdir
new file mode 100644
index 0000000..eedc81b
--- /dev/null
+++ b/debian/patches/extension_destdir
@@ -0,0 +1,270 @@
+--- a/src/backend/commands/extension.c
++++ b/src/backend/commands/extension.c
+@@ -132,6 +132,8 @@ static void ApplyExtensionUpdates(Oid ex
+ bool cascade,
+ bool is_create);
+ static char *read_whole_file(const char *filename, int *length);
++static bool file_exists(const char *name);
++static bool directory_exists(const char *dir);
+
+
+ /*
+@@ -392,6 +394,16 @@ get_extension_control_filename(const cha
+
+ get_share_path(my_exec_path, sharepath);
+ result = (char *) palloc(MAXPGPATH);
++ /*
++ * If extension_destdir is set, try to find the file there first
++ */
++ if (*extension_destdir != '\0')
++ {
++ snprintf(result, MAXPGPATH, "%s%s/extension/%s.control",
++ extension_destdir, sharepath, extname);
++ if (file_exists(result))
++ return result;
++ }
+ snprintf(result, MAXPGPATH, "%s/extension/%s.control",
+ sharepath, extname);
+
+@@ -431,6 +443,16 @@ get_extension_aux_control_filename(Exten
+ scriptdir = get_extension_script_directory(control);
+
+ result = (char *) palloc(MAXPGPATH);
++ /*
++ * If extension_destdir is set, try to find the file there first
++ */
++ if (*extension_destdir != '\0')
++ {
++ snprintf(result, MAXPGPATH, "%s%s/%s--%s.control",
++ extension_destdir, scriptdir, control->name, version);
++ if (file_exists(result))
++ return result;
++ }
+ snprintf(result, MAXPGPATH, "%s/%s--%s.control",
+ scriptdir, control->name, version);
+
+@@ -449,6 +471,23 @@ get_extension_script_filename(ExtensionC
+ scriptdir = get_extension_script_directory(control);
+
+ result = (char *) palloc(MAXPGPATH);
++ /*
++ * If extension_destdir is set, try to find the file there first
++ */
++ if (*extension_destdir != '\0')
++ {
++ if (from_version)
++ snprintf(result, MAXPGPATH, "%s%s/%s--%s--%s.sql",
++ extension_destdir, scriptdir, control->name, from_version, version);
++ else
++ snprintf(result, MAXPGPATH, "%s%s/%s--%s.sql",
++ extension_destdir, scriptdir, control->name, version);
++ if (file_exists(result))
++ {
++ pfree(scriptdir);
++ return result;
++ }
++ }
+ if (from_version)
+ snprintf(result, MAXPGPATH, "%s/%s--%s--%s.sql",
+ scriptdir, control->name, from_version, version);
+@@ -1186,6 +1225,59 @@ get_ext_ver_list(ExtensionControlFile *c
+ DIR *dir;
+ struct dirent *de;
+
++ /*
++ * If extension_destdir is set, try to find the files there first
++ */
++ if (*extension_destdir != '\0')
++ {
++ char location[MAXPGPATH];
++
++ snprintf(location, MAXPGPATH, "%s%s", extension_destdir,
++ get_extension_script_directory(control));
++ dir = AllocateDir(location);
++ while ((de = ReadDir(dir, location)) != NULL)
++ {
++ char *vername;
++ char *vername2;
++ ExtensionVersionInfo *evi;
++ ExtensionVersionInfo *evi2;
++
++ /* must be a .sql file ... */
++ if (!is_extension_script_filename(de->d_name))
++ continue;
++
++ /* ... matching extension name followed by separator */
++ if (strncmp(de->d_name, control->name, extnamelen) != 0 ||
++ de->d_name[extnamelen] != '-' ||
++ de->d_name[extnamelen + 1] != '-')
++ continue;
++
++ /* extract version name(s) from 'extname--something.sql' filename */
++ vername = pstrdup(de->d_name + extnamelen + 2);
++ *strrchr(vername, '.') = '\0';
++ vername2 = strstr(vername, "--");
++ if (!vername2)
++ {
++ /* It's an install, not update, script; record its version name */
++ evi = get_ext_ver_info(vername, &evi_list);
++ evi->installable = true;
++ continue;
++ }
++ *vername2 = '\0'; /* terminate first version */
++ vername2 += 2; /* and point to second */
++
++ /* if there's a third --, it's bogus, ignore it */
++ if (strstr(vername2, "--"))
++ continue;
++
++ /* Create ExtensionVersionInfos and link them together */
++ evi = get_ext_ver_info(vername, &evi_list);
++ evi2 = get_ext_ver_info(vername2, &evi_list);
++ evi->reachable = lappend(evi->reachable, evi2);
++ }
++ FreeDir(dir);
++ }
++
+ location = get_extension_script_directory(control);
+ dir = AllocateDir(location);
+ while ((de = ReadDir(dir, location)) != NULL)
+@@ -3470,3 +3562,32 @@ read_whole_file(const char *filename, in
+ buf[*length] = '\0';
+ return buf;
+ }
++
++static bool
++file_exists(const char *name)
++{
++ struct stat st;
++
++ Assert(name != NULL);
++
++ if (stat(name, &st) == 0)
++ return S_ISDIR(st.st_mode) ? false : true;
++ else if (!(errno == ENOENT || errno == ENOTDIR || errno == EACCES))
++ ereport(ERROR,
++ (errcode_for_file_access(),
++ errmsg("could not access file \"%s\": %m", name)));
++
++ return false;
++}
++
++static bool
++directory_exists(const char *dir)
++{
++ struct stat st;
++
++ if (stat(dir, &st) != 0)
++ return false;
++ if (S_ISDIR(st.st_mode))
++ return true;
++ return false;
++}
+--- a/src/include/utils/guc.h
++++ b/src/include/utils/guc.h
+@@ -274,6 +274,7 @@ extern PGDLLIMPORT char *ConfigFileName;
+ extern PGDLLIMPORT char *HbaFileName;
+ extern PGDLLIMPORT char *IdentFileName;
+ extern PGDLLIMPORT char *external_pid_file;
++extern PGDLLIMPORT char *extension_destdir;
+
+ extern PGDLLIMPORT char *application_name;
+
+--- a/src/backend/utils/fmgr/dfmgr.c
++++ b/src/backend/utils/fmgr/dfmgr.c
+@@ -34,6 +34,7 @@
+ #include "lib/stringinfo.h"
+ #include "miscadmin.h"
+ #include "storage/shmem.h"
++#include "utils/guc.h"
+ #include "utils/hsearch.h"
+
+
+@@ -432,7 +433,7 @@ expand_dynamic_library_name(const char *
+ {
+ bool have_slash;
+ char *new;
+- char *full;
++ char *full, *full2;
+
+ Assert(name);
+
+@@ -447,6 +448,19 @@ expand_dynamic_library_name(const char *
+ else
+ {
+ full = substitute_libpath_macro(name);
++ /*
++ * If extension_destdir is set, try to find the file there first
++ */
++ if (*extension_destdir != '\0')
++ {
++ full2 = psprintf("%s%s", extension_destdir, full);
++ if (file_exists(full2))
++ {
++ pfree(full);
++ return full2;
++ }
++ pfree(full2);
++ }
+ if (file_exists(full))
+ return full;
+ pfree(full);
+@@ -465,6 +479,19 @@ expand_dynamic_library_name(const char *
+ {
+ full = substitute_libpath_macro(new);
+ pfree(new);
++ /*
++ * If extension_destdir is set, try to find the file there first
++ */
++ if (*extension_destdir != '\0')
++ {
++ full2 = psprintf("%s%s", extension_destdir, full);
++ if (file_exists(full2))
++ {
++ pfree(full);
++ return full2;
++ }
++ pfree(full2);
++ }
+ if (file_exists(full))
+ return full;
+ pfree(full);
+--- a/src/backend/utils/misc/postgresql.conf.sample
++++ b/src/backend/utils/misc/postgresql.conf.sample
+@@ -750,6 +750,8 @@
+ # - Other Defaults -
+
+ #dynamic_library_path = '$libdir'
++#extension_destdir = '' # prepend path when loading extensions
++ # and shared objects (added by Debian)
+ #gin_fuzzy_search_limit = 0
+
+
+--- a/src/backend/utils/misc/guc_tables.c
++++ b/src/backend/utils/misc/guc_tables.c
+@@ -528,6 +528,7 @@ char *ConfigFileName;
+ char *HbaFileName;
+ char *IdentFileName;
+ char *external_pid_file;
++char *extension_destdir;
+
+ char *application_name;
+
+@@ -4346,6 +4347,17 @@ struct config_string ConfigureNamesStrin
+ },
+
+ {
++ {"extension_destdir", PGC_SUSET, FILE_LOCATIONS,
++ gettext_noop("Path to prepend for extension loading."),
++ gettext_noop("This directory is prepended to paths when loading extensions (control and SQL files), and to the '$libdir' directive when loading modules that back functions. The location is made configurable to allow build-time testing of extensions that do not have been installed to their proper location yet."),
++ GUC_SUPERUSER_ONLY
++ },
++ &extension_destdir,
++ "",
++ NULL, NULL, NULL
++ },
++
++ {
+ {"ssl_library", PGC_INTERNAL, PRESET_OPTIONS,
+ gettext_noop("Shows the name of the SSL library."),
+ NULL,
diff --git a/debian/patches/filter-debug-prefix-map b/debian/patches/filter-debug-prefix-map
new file mode 100644
index 0000000..dcfa9d8
--- /dev/null
+++ b/debian/patches/filter-debug-prefix-map
@@ -0,0 +1,44 @@
+To make the PostgreSQL server packages build reproducibly, we need to remove
+the build path from -fdebug-prefix-map and -ffile-prefix-map in CFLAGS.
+
+* The actual server build still uses the original CFLAGS so the build path is
+ correctly mapped in the object files.
+* The information printed by the pg_config binary and the system view is
+ filtered in src/common/Makefile and the configure script.
+* The build paths stored in Makefile.global are filtered in debian/rules.
+ (abs_top_builddir, abs_top_srcdir, configure_args, CFLAGS)
+* To make PGXS module builds reproducible, pg_buildext copies the environment
+ CFLAGS to COPT where Makefile.global picks them up, using the prefix maps
+ from dpkg-buildflags.
+
+--- a/src/common/Makefile
++++ b/src/common/Makefile
+@@ -33,7 +33,7 @@ STD_CPPFLAGS := $(filter-out -I$(top_src
+ STD_LDFLAGS := $(filter-out -L$(top_builddir)/src/common -L$(top_builddir)/src/port,$(LDFLAGS))
+ override CPPFLAGS += -DVAL_CC="\"$(CC)\""
+ override CPPFLAGS += -DVAL_CPPFLAGS="\"$(STD_CPPFLAGS)\""
+-override CPPFLAGS += -DVAL_CFLAGS="\"$(CFLAGS)\""
++override CPPFLAGS += -DVAL_CFLAGS="\"$(filter-out -fdebug-prefix-map=% -ffile-prefix-map=%,$(CFLAGS))\""
+ override CPPFLAGS += -DVAL_CFLAGS_SL="\"$(CFLAGS_SL)\""
+ override CPPFLAGS += -DVAL_LDFLAGS="\"$(STD_LDFLAGS)\""
+ override CPPFLAGS += -DVAL_LDFLAGS_EX="\"$(LDFLAGS_EX)\""
+--- a/configure.ac
++++ b/configure.ac
+@@ -27,6 +27,7 @@ AC_COPYRIGHT([Copyright (c) 1996-2023, P
+ AC_CONFIG_SRCDIR([src/backend/access/common/heaptuple.c])
+ AC_CONFIG_AUX_DIR(config)
+ AC_PREFIX_DEFAULT(/usr/local/pgsql)
++[ac_configure_args=$(echo "$ac_configure_args" | sed -e "s/ -f\(debug\|file\)-prefix-map=[^' ]*//g")]
+ AC_DEFINE_UNQUOTED(CONFIGURE_ARGS, ["$ac_configure_args"], [Saved arguments from configure])
+
+ [PG_MAJORVERSION=`expr "$PACKAGE_VERSION" : '\([0-9][0-9]*\)'`]
+--- a/configure
++++ b/configure
+@@ -2822,6 +2822,7 @@ ac_config_sub="$SHELL $ac_aux_dir/config
+ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
+
+
++ac_configure_args=$(echo "$ac_configure_args" | sed -e "s/ -f\(debug\|file\)-prefix-map=[^' ]*//g")
+
+
+ cat >>confdefs.h <<_ACEOF
diff --git a/debian/patches/focal-arm64-outline-atomics b/debian/patches/focal-arm64-outline-atomics
new file mode 100644
index 0000000..b87d8f5
--- /dev/null
+++ b/debian/patches/focal-arm64-outline-atomics
@@ -0,0 +1,23 @@
+Enable outline-atomics on arm64.
+
+The flag was added in focal's gcc, but is off by default there. It is enabled
+by default on all later distributions (hirsute, impish, bullseye, bookwork,
+sid).
+
+https://www.postgresql.org/message-id/flat/1635221042457.21654%40amazon.com
+
+This patch can be removed once focal is EOL.
+
+--- a/configure.ac
++++ b/configure.ac
+@@ -576,6 +576,10 @@ if test "$GCC" = yes -a "$ICC" = no; the
+ if test -n "$NOT_THE_CFLAGS"; then
+ CFLAGS="$CFLAGS -Wno-cast-function-type-strict"
+ fi
++ if test x"$host_cpu" == x"aarch64"; then
++ PGAC_PROG_CC_CFLAGS_OPT([-moutline-atomics])
++ PGAC_PROG_CXX_CFLAGS_OPT([-moutline-atomics])
++ fi
+ elif test "$ICC" = yes; then
+ # Intel's compiler has a bug/misoptimization in checking for
+ # division by NAN (NaN == 0), -mp1 fixes it, so add it to the CFLAGS.
diff --git a/debian/patches/hurd-iovec b/debian/patches/hurd-iovec
new file mode 100644
index 0000000..e5255f0
--- /dev/null
+++ b/debian/patches/hurd-iovec
@@ -0,0 +1,26 @@
+hurd-i386 does not define IOV_MAX
+
+--- a/src/include/port/pg_iovec.h
++++ b/src/include/port/pg_iovec.h
+@@ -20,9 +20,6 @@
+
+ #else
+
+-/* POSIX requires at least 16 as a maximum iovcnt. */
+-#define IOV_MAX 16
+-
+ /* Define our own POSIX-compatible iovec struct. */
+ struct iovec
+ {
+@@ -32,6 +29,11 @@ struct iovec
+
+ #endif
+
++/* POSIX requires at least 16 as a maximum iovcnt. */
++#ifndef IOV_MAX
++#define IOV_MAX 16
++#endif
++
+ /* Define a reasonable maximum that is safe to use on the stack. */
+ #define PG_IOV_MAX Min(IOV_MAX, 32)
+
diff --git a/debian/patches/jit-s390x b/debian/patches/jit-s390x
new file mode 100644
index 0000000..deb64e6
--- /dev/null
+++ b/debian/patches/jit-s390x
@@ -0,0 +1,96 @@
+From 0edaa982336823d4d7af8f10b91579fe0099ef3d Mon Sep 17 00:00:00 2001
+From: Tom Stellard <tstellar@redhat.com>
+Date: Tue, 20 Apr 2021 20:14:21 -0700
+Subject: [PATCH] jit: Workaround potential datalayout mismatch on s390x
+
+LLVM's s390x target uses a different datalayout for z13 and newer processors.
+If llvmjit_types.bc is compiled to target a processor older than z13, and
+then the JIT runs on a z13 or newer processor, then there will be a mismatch
+in datalayouts between llvmjit_types.bc and the JIT engine. This mismatch
+causes the JIT to fail at runtime.
+---
+ src/backend/jit/llvm/llvmjit.c | 46 ++++++++++++++++++++++++++++++++--
+ 1 file changed, 44 insertions(+), 2 deletions(-)
+
+--- a/src/backend/jit/llvm/llvmjit.c
++++ b/src/backend/jit/llvm/llvmjit.c
+@@ -777,6 +777,37 @@ llvm_compile_module(LLVMJitContext *cont
+ }
+
+ /*
++ * For the systemz target, LLVM uses a different datalayout for z13 and newer
++ * CPUs than it does for older CPUs. This can cause a mismatch in datalayouts
++ * in the case where the llvm_types_module is compiled with a pre-z13 CPU
++ * and the JIT is running on z13 or newer.
++ * See computeDataLayout() function in
++ * llvm/lib/Target/SystemZ/SystemZTargetMachine.cpp for information on the
++ * datalayout differences.
++ */
++static bool
++needs_systemz_workaround(void)
++{
++ bool ret = false;
++#ifdef __s390x__
++ LLVMContextRef llvm_context;
++ LLVMTypeRef vec_type;
++ LLVMTargetDataRef llvm_layoutref;
++ if (strncmp(LLVMGetTargetName(llvm_targetref), "systemz", strlen("systemz")))
++ {
++ return false;
++ }
++
++ llvm_context = LLVMGetModuleContext(llvm_types_module);
++ vec_type = LLVMVectorType(LLVMIntTypeInContext(llvm_context, 32), 4);
++ llvm_layoutref = LLVMCreateTargetData(llvm_layout);
++ ret = (LLVMABIAlignmentOfType(llvm_layoutref, vec_type) == 16);
++ LLVMDisposeTargetData(llvm_layoutref);
++#endif
++ return ret;
++}
++
++/*
+ * Per session initialization.
+ */
+ static void
+@@ -785,6 +816,7 @@ llvm_session_initialize(void)
+ MemoryContext oldcontext;
+ char *error = NULL;
+ char *cpu = NULL;
++ char *host_features = NULL;
+ char *features = NULL;
+ LLVMTargetMachineRef opt0_tm;
+ LLVMTargetMachineRef opt3_tm;
+@@ -826,10 +858,17 @@ llvm_session_initialize(void)
+ * features not all CPUs have (weird, huh).
+ */
+ cpu = LLVMGetHostCPUName();
+- features = LLVMGetHostCPUFeatures();
++ features = host_features = LLVMGetHostCPUFeatures();
+ elog(DEBUG2, "LLVMJIT detected CPU \"%s\", with features \"%s\"",
+ cpu, features);
+
++ if (needs_systemz_workaround())
++ {
++ const char *no_vector =",-vector";
++ features = malloc(sizeof(char) * (strlen(host_features) + strlen(no_vector) + 1));
++ sprintf(features, "%s%s", host_features, no_vector);
++ }
++
+ opt0_tm =
+ LLVMCreateTargetMachine(llvm_targetref, llvm_triple, cpu, features,
+ LLVMCodeGenLevelNone,
+@@ -843,8 +882,13 @@ llvm_session_initialize(void)
+
+ LLVMDisposeMessage(cpu);
+ cpu = NULL;
+- LLVMDisposeMessage(features);
++ if (features != host_features)
++ {
++ free(features);
++ }
+ features = NULL;
++ LLVMDisposeMessage(host_features);
++ host_features = NULL;
+
+ /* force symbols in main binary to be loaded */
+ LLVMLoadLibraryPermanently(NULL);
diff --git a/debian/patches/libpgport-pkglibdir b/debian/patches/libpgport-pkglibdir
new file mode 100644
index 0000000..dc76bcc
--- /dev/null
+++ b/debian/patches/libpgport-pkglibdir
@@ -0,0 +1,91 @@
+Author: Christoph Berg <myon@debian.org>
+Description: Move libpgport/libpgcommon/libpgfeutils from libdir to pkglibdir
+ This allows client applications to link to version-specific libraries.
+ Used by pg-checksums.
+Forwarded: No, (somewhat) Debian specific
+
+--- a/src/common/Makefile
++++ b/src/common/Makefile
+@@ -125,15 +125,15 @@ distprep: kwlist_d.h
+
+ # libpgcommon is needed by some contrib
+ install: all installdirs
+- $(INSTALL_STLIB) libpgcommon.a '$(DESTDIR)$(libdir)/libpgcommon.a'
+- $(INSTALL_STLIB) libpgcommon_shlib.a '$(DESTDIR)$(libdir)/libpgcommon_shlib.a'
++ $(INSTALL_STLIB) libpgcommon.a '$(DESTDIR)$(pkglibdir)/libpgcommon.a'
++ $(INSTALL_STLIB) libpgcommon_shlib.a '$(DESTDIR)$(pkglibdir)/libpgcommon_shlib.a'
+
+ installdirs:
+- $(MKDIR_P) '$(DESTDIR)$(libdir)'
++ $(MKDIR_P) '$(DESTDIR)$(pkglibdir)'
+
+ uninstall:
+- rm -f '$(DESTDIR)$(libdir)/libpgcommon.a'
+- rm -f '$(DESTDIR)$(libdir)/libpgcommon_shlib.a'
++ rm -f '$(DESTDIR)$(pkglibdir)/libpgcommon.a'
++ rm -f '$(DESTDIR)$(pkglibdir)/libpgcommon_shlib.a'
+
+ libpgcommon.a: $(OBJS_FRONTEND)
+ rm -f $@
+--- a/src/fe_utils/Makefile
++++ b/src/fe_utils/Makefile
+@@ -52,13 +52,13 @@ distprep: psqlscan.c
+
+ # libpgfeutils could be useful to contrib, so install it
+ install: all installdirs
+- $(INSTALL_STLIB) libpgfeutils.a '$(DESTDIR)$(libdir)/libpgfeutils.a'
++ $(INSTALL_STLIB) libpgfeutils.a '$(DESTDIR)$(pkglibdir)/libpgfeutils.a'
+
+ installdirs:
+- $(MKDIR_P) '$(DESTDIR)$(libdir)'
++ $(MKDIR_P) '$(DESTDIR)$(pkglibdir)'
+
+ uninstall:
+- rm -f '$(DESTDIR)$(libdir)/libpgfeutils.a'
++ rm -f '$(DESTDIR)$(pkglibdir)/libpgfeutils.a'
+
+ clean distclean:
+ rm -f libpgfeutils.a $(OBJS) lex.backup
+--- a/src/port/Makefile
++++ b/src/port/Makefile
+@@ -70,15 +70,15 @@ all: libpgport.a libpgport_shlib.a libpg
+
+ # libpgport is needed by some contrib
+ install: all installdirs
+- $(INSTALL_STLIB) libpgport.a '$(DESTDIR)$(libdir)/libpgport.a'
+- $(INSTALL_STLIB) libpgport_shlib.a '$(DESTDIR)$(libdir)/libpgport_shlib.a'
++ $(INSTALL_STLIB) libpgport.a '$(DESTDIR)$(pkglibdir)/libpgport.a'
++ $(INSTALL_STLIB) libpgport_shlib.a '$(DESTDIR)$(pkglibdir)/libpgport_shlib.a'
+
+ installdirs:
+- $(MKDIR_P) '$(DESTDIR)$(libdir)'
++ $(MKDIR_P) '$(DESTDIR)$(pkglibdir)'
+
+ uninstall:
+- rm -f '$(DESTDIR)$(libdir)/libpgport.a'
+- rm -f '$(DESTDIR)$(libdir)/libpgport_shlib.a'
++ rm -f '$(DESTDIR)$(pkglibdir)/libpgport.a'
++ rm -f '$(DESTDIR)$(pkglibdir)/libpgport_shlib.a'
+
+ libpgport.a: $(OBJS)
+ rm -f $@
+--- a/src/Makefile.global.in
++++ b/src/Makefile.global.in
+@@ -599,7 +599,7 @@ libpq = -L$(libpq_builddir) -lpq
+ ifeq ($(PORTNAME),darwin)
+ libpq_pgport = $(libpq)
+ else ifdef PGXS
+-libpq_pgport = -L$(libdir) -lpgcommon -lpgport $(libpq)
++libpq_pgport = -L$(pkglibdir) -lpgcommon -lpgport $(libpq)
+ else
+ libpq_pgport = -L$(top_builddir)/src/common -lpgcommon -L$(top_builddir)/src/port -lpgport $(libpq)
+ endif
+@@ -610,7 +610,7 @@ endif
+ # done if they don't, since they will have satisfied all their references
+ # from these libraries.)
+ ifdef PGXS
+-libpq_pgport_shlib = -L$(libdir) -lpgcommon_shlib -lpgport_shlib $(libpq)
++libpq_pgport_shlib = -L$(pkglibdir) -lpgcommon_shlib -lpgport_shlib $(libpq)
+ else
+ libpq_pgport_shlib = -L$(top_builddir)/src/common -lpgcommon_shlib -L$(top_builddir)/src/port -lpgport_shlib $(libpq)
+ endif
diff --git a/debian/patches/pgstat-report-conflicts-immediately.patch b/debian/patches/pgstat-report-conflicts-immediately.patch
new file mode 100644
index 0000000..5760310
--- /dev/null
+++ b/debian/patches/pgstat-report-conflicts-immediately.patch
@@ -0,0 +1,37 @@
+diff --git i/src/backend/utils/activity/pgstat_database.c w/src/backend/utils/activity/pgstat_database.c
+index 7149f22f729..bb36d73ec04 100644
+--- i/src/backend/utils/activity/pgstat_database.c
++++ w/src/backend/utils/activity/pgstat_database.c
+@@ -81,12 +81,22 @@ void
+ pgstat_report_recovery_conflict(int reason)
+ {
+ PgStat_StatDBEntry *dbentry;
++ PgStat_EntryRef *entry_ref;
++ PgStatShared_Database *sharedent;
+
+ Assert(IsUnderPostmaster);
+ if (!pgstat_track_counts)
+ return;
+
+- dbentry = pgstat_prep_database_pending(MyDatabaseId);
++ /*
++ * Update the shared stats directly - recovery conflicts should never be
++ * common enough for that to be a problem.
++ */
++ entry_ref =
++ pgstat_get_entry_ref_locked(PGSTAT_KIND_DATABASE, MyDatabaseId, InvalidOid, false);
++
++ sharedent = (PgStatShared_Database *) entry_ref->shared_stats;
++ dbentry = &sharedent->stats;
+
+ switch (reason)
+ {
+@@ -116,6 +126,8 @@ pgstat_report_recovery_conflict(int reason)
+ dbentry->conflict_startup_deadlock++;
+ break;
+ }
++
++ pgstat_unlock_entry(entry_ref);
+ }
+
+ /*
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..3271c55
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,15 @@
+50-per-version-dirs.patch
+51-default-sockets-in-var.patch
+52-tutorial-README.patch
+53-pg_service.conf_directory_doc.patch
+54-debian-alternatives-for-external-tools.patch
+70-history
+filter-debug-prefix-map
+libpgport-pkglibdir
+extension_destdir
+autoconf2.69
+focal-arm64-outline-atomics
+jit-s390x
+hurd-iovec
+v8-0001-Fix-recovery-conflict-SIGUSR1-handling.patch
+pgstat-report-conflicts-immediately.patch
diff --git a/debian/patches/v8-0001-Fix-recovery-conflict-SIGUSR1-handling.patch b/debian/patches/v8-0001-Fix-recovery-conflict-SIGUSR1-handling.patch
new file mode 100644
index 0000000..da4cb64
--- /dev/null
+++ b/debian/patches/v8-0001-Fix-recovery-conflict-SIGUSR1-handling.patch
@@ -0,0 +1,557 @@
+From 6544931e533aa015f39215f9c9d2df3e06700a96 Mon Sep 17 00:00:00 2001
+From: Thomas Munro <thomas.munro@gmail.com>
+Date: Tue, 10 May 2022 16:00:23 +1200
+Subject: [PATCH v8] Fix recovery conflict SIGUSR1 handling.
+
+We shouldn't be doing real work in a signal handler, to avoid reaching
+code that is not safe in that context. The previous coding also
+confused the 'reason' shown in error messages by clobbering global
+variables. Move all recovery conflict checking logic into the next CFI,
+and have the signal handler just set flags and the latch, following the
+standard pattern. Since there are several different reasons, use a
+separate flag for each.
+
+With this refactoring, the recovery conflict system no longer
+piggy-backs on top of the regular query cancelation mechanisms, but
+instead ereports directly if it decides that is necessary. It still
+needs to respect QueryCancelHoldoffCount, because otherwise the FEBE
+protocol might be corrupted (see commit 2b3a8b20c2d).
+
+Back-patch to 16. For now we have agreed not to back-patch this change
+any further than that, due to its complexity and the regex changes in
+commit bea3d7e that it depends on.
+
+Reviewed-by: Andres Freund <andres@anarazel.de>
+Reviewed-by: Michael Paquier <michael@paquier.xyz>
+Reviewed-by: Robert Haas <robertmhaas@gmail.com>
+Discussion: https://postgr.es/m/CA%2BhUKGK3PGKwcKqzoosamn36YW-fsuTdOPPF1i_rtEO%3DnEYKSg%40mail.gmail.com
+---
+ src/backend/storage/buffer/bufmgr.c | 4 +-
+ src/backend/storage/ipc/procsignal.c | 14 +-
+ src/backend/tcop/postgres.c | 333 ++++++++++++++-------------
+ src/include/storage/procsignal.h | 4 +-
+ src/include/tcop/tcopprot.h | 3 +-
+ 5 files changed, 188 insertions(+), 170 deletions(-)
+
+diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c
+index df22aaa1c5..55c484a43e 100644
+--- a/src/backend/storage/buffer/bufmgr.c
++++ b/src/backend/storage/buffer/bufmgr.c
+@@ -4923,8 +4923,8 @@ LockBufferForCleanup(Buffer buffer)
+ }
+
+ /*
+- * Check called from RecoveryConflictInterrupt handler when Startup
+- * process requests cancellation of all pin holders that are blocking it.
++ * Check called from ProcessRecoveryConflictInterrupts() when Startup process
++ * requests cancellation of all pin holders that are blocking it.
+ */
+ bool
+ HoldingBufferPinThatDelaysRecovery(void)
+diff --git a/src/backend/storage/ipc/procsignal.c b/src/backend/storage/ipc/procsignal.c
+index c85cb5cc18..b7427906de 100644
+--- a/src/backend/storage/ipc/procsignal.c
++++ b/src/backend/storage/ipc/procsignal.c
+@@ -662,25 +662,25 @@ procsignal_sigusr1_handler(SIGNAL_ARGS)
+ HandleParallelApplyMessageInterrupt();
+
+ if (CheckProcSignal(PROCSIG_RECOVERY_CONFLICT_DATABASE))
+- RecoveryConflictInterrupt(PROCSIG_RECOVERY_CONFLICT_DATABASE);
++ HandleRecoveryConflictInterrupt(PROCSIG_RECOVERY_CONFLICT_DATABASE);
+
+ if (CheckProcSignal(PROCSIG_RECOVERY_CONFLICT_TABLESPACE))
+- RecoveryConflictInterrupt(PROCSIG_RECOVERY_CONFLICT_TABLESPACE);
++ HandleRecoveryConflictInterrupt(PROCSIG_RECOVERY_CONFLICT_TABLESPACE);
+
+ if (CheckProcSignal(PROCSIG_RECOVERY_CONFLICT_LOCK))
+- RecoveryConflictInterrupt(PROCSIG_RECOVERY_CONFLICT_LOCK);
++ HandleRecoveryConflictInterrupt(PROCSIG_RECOVERY_CONFLICT_LOCK);
+
+ if (CheckProcSignal(PROCSIG_RECOVERY_CONFLICT_SNAPSHOT))
+- RecoveryConflictInterrupt(PROCSIG_RECOVERY_CONFLICT_SNAPSHOT);
++ HandleRecoveryConflictInterrupt(PROCSIG_RECOVERY_CONFLICT_SNAPSHOT);
+
+ if (CheckProcSignal(PROCSIG_RECOVERY_CONFLICT_LOGICALSLOT))
+- RecoveryConflictInterrupt(PROCSIG_RECOVERY_CONFLICT_LOGICALSLOT);
++ HandleRecoveryConflictInterrupt(PROCSIG_RECOVERY_CONFLICT_LOGICALSLOT);
+
+ if (CheckProcSignal(PROCSIG_RECOVERY_CONFLICT_STARTUP_DEADLOCK))
+- RecoveryConflictInterrupt(PROCSIG_RECOVERY_CONFLICT_STARTUP_DEADLOCK);
++ HandleRecoveryConflictInterrupt(PROCSIG_RECOVERY_CONFLICT_STARTUP_DEADLOCK);
+
+ if (CheckProcSignal(PROCSIG_RECOVERY_CONFLICT_BUFFERPIN))
+- RecoveryConflictInterrupt(PROCSIG_RECOVERY_CONFLICT_BUFFERPIN);
++ HandleRecoveryConflictInterrupt(PROCSIG_RECOVERY_CONFLICT_BUFFERPIN);
+
+ SetLatch(MyLatch);
+
+diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
+index 36cc99ec9c..fab976227f 100644
+--- a/src/backend/tcop/postgres.c
++++ b/src/backend/tcop/postgres.c
+@@ -161,9 +161,8 @@ static bool EchoQuery = false; /* -E switch */
+ static bool UseSemiNewlineNewline = false; /* -j switch */
+
+ /* whether or not, and why, we were canceled by conflict with recovery */
+-static bool RecoveryConflictPending = false;
+-static bool RecoveryConflictRetryable = true;
+-static ProcSignalReason RecoveryConflictReason;
++static volatile sig_atomic_t RecoveryConflictPending = false;
++static volatile sig_atomic_t RecoveryConflictPendingReasons[NUM_PROCSIGNALS];
+
+ /* reused buffer to pass to SendRowDescriptionMessage() */
+ static MemoryContext row_description_context = NULL;
+@@ -182,7 +181,6 @@ static bool check_log_statement(List *stmt_list);
+ static int errdetail_execute(List *raw_parsetree_list);
+ static int errdetail_params(ParamListInfo params);
+ static int errdetail_abort(void);
+-static int errdetail_recovery_conflict(void);
+ static void bind_param_error_callback(void *arg);
+ static void start_xact_command(void);
+ static void finish_xact_command(void);
+@@ -2510,9 +2508,9 @@ errdetail_abort(void)
+ * Add an errdetail() line showing conflict source.
+ */
+ static int
+-errdetail_recovery_conflict(void)
++errdetail_recovery_conflict(ProcSignalReason reason)
+ {
+- switch (RecoveryConflictReason)
++ switch (reason)
+ {
+ case PROCSIG_RECOVERY_CONFLICT_BUFFERPIN:
+ errdetail("User was holding shared buffer pin for too long.");
+@@ -3040,143 +3038,205 @@ FloatExceptionHandler(SIGNAL_ARGS)
+ }
+
+ /*
+- * RecoveryConflictInterrupt: out-of-line portion of recovery conflict
+- * handling following receipt of SIGUSR1. Designed to be similar to die()
+- * and StatementCancelHandler(). Called only by a normal user backend
+- * that begins a transaction during recovery.
++ * Tell the next CHECK_FOR_INTERRUPTS() to check for a particular type of
++ * recovery conflict. Runs in a SIGUSR1 handler.
+ */
+ void
+-RecoveryConflictInterrupt(ProcSignalReason reason)
++HandleRecoveryConflictInterrupt(ProcSignalReason reason)
+ {
+- int save_errno = errno;
++ RecoveryConflictPendingReasons[reason] = true;
++ RecoveryConflictPending = true;
++ InterruptPending = true;
++ /* latch will be set by procsignal_sigusr1_handler */
++}
+
+- /*
+- * Don't joggle the elbow of proc_exit
+- */
+- if (!proc_exit_inprogress)
++/*
++ * Check one individual conflict reason.
++ */
++static void
++ProcessRecoveryConflictInterrupt(ProcSignalReason reason)
++{
++ switch (reason)
+ {
+- RecoveryConflictReason = reason;
+- switch (reason)
+- {
+- case PROCSIG_RECOVERY_CONFLICT_STARTUP_DEADLOCK:
++ case PROCSIG_RECOVERY_CONFLICT_STARTUP_DEADLOCK:
+
+- /*
+- * If we aren't waiting for a lock we can never deadlock.
+- */
+- if (!IsWaitingForLock())
+- return;
++ /*
++ * If we aren't waiting for a lock we can never deadlock.
++ */
++ if (!IsWaitingForLock())
++ return;
+
+- /* Intentional fall through to check wait for pin */
+- /* FALLTHROUGH */
++ /* Intentional fall through to check wait for pin */
++ /* FALLTHROUGH */
+
+- case PROCSIG_RECOVERY_CONFLICT_BUFFERPIN:
++ case PROCSIG_RECOVERY_CONFLICT_BUFFERPIN:
+
+- /*
+- * If PROCSIG_RECOVERY_CONFLICT_BUFFERPIN is requested but we
+- * aren't blocking the Startup process there is nothing more
+- * to do.
+- *
+- * When PROCSIG_RECOVERY_CONFLICT_STARTUP_DEADLOCK is
+- * requested, if we're waiting for locks and the startup
+- * process is not waiting for buffer pin (i.e., also waiting
+- * for locks), we set the flag so that ProcSleep() will check
+- * for deadlocks.
+- */
+- if (!HoldingBufferPinThatDelaysRecovery())
+- {
+- if (reason == PROCSIG_RECOVERY_CONFLICT_STARTUP_DEADLOCK &&
+- GetStartupBufferPinWaitBufId() < 0)
+- CheckDeadLockAlert();
+- return;
+- }
++ /*
++ * If PROCSIG_RECOVERY_CONFLICT_BUFFERPIN is requested but we
++ * aren't blocking the Startup process there is nothing more to
++ * do.
++ *
++ * When PROCSIG_RECOVERY_CONFLICT_STARTUP_DEADLOCK is requested,
++ * if we're waiting for locks and the startup process is not
++ * waiting for buffer pin (i.e., also waiting for locks), we set
++ * the flag so that ProcSleep() will check for deadlocks.
++ */
++ if (!HoldingBufferPinThatDelaysRecovery())
++ {
++ if (reason == PROCSIG_RECOVERY_CONFLICT_STARTUP_DEADLOCK &&
++ GetStartupBufferPinWaitBufId() < 0)
++ CheckDeadLockAlert();
++ return;
++ }
+
+- MyProc->recoveryConflictPending = true;
++ MyProc->recoveryConflictPending = true;
+
+- /* Intentional fall through to error handling */
+- /* FALLTHROUGH */
++ /* Intentional fall through to error handling */
++ /* FALLTHROUGH */
+
+- case PROCSIG_RECOVERY_CONFLICT_LOCK:
+- case PROCSIG_RECOVERY_CONFLICT_TABLESPACE:
+- case PROCSIG_RECOVERY_CONFLICT_SNAPSHOT:
++ case PROCSIG_RECOVERY_CONFLICT_LOCK:
++ case PROCSIG_RECOVERY_CONFLICT_TABLESPACE:
++ case PROCSIG_RECOVERY_CONFLICT_SNAPSHOT:
+
++ /*
++ * If we aren't in a transaction any longer then ignore.
++ */
++ if (!IsTransactionOrTransactionBlock())
++ return;
++
++ /* FALLTHROUGH */
++
++ case PROCSIG_RECOVERY_CONFLICT_LOGICALSLOT:
++
++ /*
++ * If we're not in a subtransaction then we are OK to throw an
++ * ERROR to resolve the conflict. Otherwise drop through to the
++ * FATAL case.
++ *
++ * PROCSIG_RECOVERY_CONFLICT_LOGICALSLOT is a special case that
++ * always throws an ERROR (ie never promotes to FATAL), though it
++ * still has to respect QueryCancelHoldoffCount, so it shares this
++ * code path. Logical decoding slots are only acquired while
++ * performing logical decoding. During logical decoding no user
++ * controlled code is run. During [sub]transaction abort, the
++ * slot is released. Therefore user controlled code cannot
++ * intercept an error before the replication slot is released.
++ *
++ * XXX other times that we can throw just an ERROR *may* be
++ * PROCSIG_RECOVERY_CONFLICT_LOCK if no locks are held in parent
++ * transactions
++ *
++ * PROCSIG_RECOVERY_CONFLICT_SNAPSHOT if no snapshots are held by
++ * parent transactions and the transaction is not
++ * transaction-snapshot mode
++ *
++ * PROCSIG_RECOVERY_CONFLICT_TABLESPACE if no temp files or
++ * cursors open in parent transactions
++ */
++ if (reason == PROCSIG_RECOVERY_CONFLICT_LOGICALSLOT ||
++ !IsSubTransaction())
++ {
+ /*
+- * If we aren't in a transaction any longer then ignore.
++ * If we already aborted then we no longer need to cancel. We
++ * do this here since we do not wish to ignore aborted
++ * subtransactions, which must cause FATAL, currently.
+ */
+- if (!IsTransactionOrTransactionBlock())
++ if (IsAbortedTransactionBlockState())
+ return;
+
+ /*
+- * If we can abort just the current subtransaction then we are
+- * OK to throw an ERROR to resolve the conflict. Otherwise
+- * drop through to the FATAL case.
+- *
+- * XXX other times that we can throw just an ERROR *may* be
+- * PROCSIG_RECOVERY_CONFLICT_LOCK if no locks are held in
+- * parent transactions
+- *
+- * PROCSIG_RECOVERY_CONFLICT_SNAPSHOT if no snapshots are held
+- * by parent transactions and the transaction is not
+- * transaction-snapshot mode
+- *
+- * PROCSIG_RECOVERY_CONFLICT_TABLESPACE if no temp files or
+- * cursors open in parent transactions
++ * If a recovery conflict happens while we are waiting for
++ * input from the client, the client is presumably just
++ * sitting idle in a transaction, preventing recovery from
++ * making progress. We'll drop through to the FATAL case
++ * below to dislodge it, in that case.
+ */
+- if (!IsSubTransaction())
++ if (!DoingCommandRead)
+ {
+- /*
+- * If we already aborted then we no longer need to cancel.
+- * We do this here since we do not wish to ignore aborted
+- * subtransactions, which must cause FATAL, currently.
+- */
+- if (IsAbortedTransactionBlockState())
++ /* Avoid losing sync in the FE/BE protocol. */
++ if (QueryCancelHoldoffCount != 0)
++ {
++ /*
++ * Re-arm and defer this interrupt until later. See
++ * similar code in ProcessInterrupts().
++ */
++ RecoveryConflictPendingReasons[reason] = true;
++ RecoveryConflictPending = true;
++ InterruptPending = true;
+ return;
++ }
+
+- RecoveryConflictPending = true;
+- QueryCancelPending = true;
+- InterruptPending = true;
++ /*
++ * We are cleared to throw an ERROR. Either it's the
++ * logical slot case, or we have a top-level transaction
++ * that we can abort and a conflict that isn't inherently
++ * non-retryable.
++ */
++ LockErrorCleanup();
++ pgstat_report_recovery_conflict(reason);
++ ereport(ERROR,
++ (errcode(ERRCODE_T_R_SERIALIZATION_FAILURE),
++ errmsg("canceling statement due to conflict with recovery"),
++ errdetail_recovery_conflict(reason)));
+ break;
+ }
++ }
+
+- /* Intentional fall through to session cancel */
+- /* FALLTHROUGH */
+-
+- case PROCSIG_RECOVERY_CONFLICT_DATABASE:
+- RecoveryConflictPending = true;
+- ProcDiePending = true;
+- InterruptPending = true;
+- break;
+-
+- case PROCSIG_RECOVERY_CONFLICT_LOGICALSLOT:
+- RecoveryConflictPending = true;
+- QueryCancelPending = true;
+- InterruptPending = true;
+- break;
++ /* Intentional fall through to session cancel */
++ /* FALLTHROUGH */
+
+- default:
+- elog(FATAL, "unrecognized conflict mode: %d",
+- (int) reason);
+- }
++ case PROCSIG_RECOVERY_CONFLICT_DATABASE:
+
+- Assert(RecoveryConflictPending && (QueryCancelPending || ProcDiePending));
++ /*
++ * Retrying is not possible because the database is dropped, or we
++ * decided above that we couldn't resolve the conflict with an
++ * ERROR and fell through. Terminate the session.
++ */
++ pgstat_report_recovery_conflict(reason);
++ ereport(FATAL,
++ (errcode(reason == PROCSIG_RECOVERY_CONFLICT_DATABASE ?
++ ERRCODE_DATABASE_DROPPED :
++ ERRCODE_T_R_SERIALIZATION_FAILURE),
++ errmsg("terminating connection due to conflict with recovery"),
++ errdetail_recovery_conflict(reason),
++ errhint("In a moment you should be able to reconnect to the"
++ " database and repeat your command.")));
++ break;
+
+- /*
+- * All conflicts apart from database cause dynamic errors where the
+- * command or transaction can be retried at a later point with some
+- * potential for success. No need to reset this, since non-retryable
+- * conflict errors are currently FATAL.
+- */
+- if (reason == PROCSIG_RECOVERY_CONFLICT_DATABASE)
+- RecoveryConflictRetryable = false;
++ default:
++ elog(FATAL, "unrecognized conflict mode: %d", (int) reason);
+ }
++}
++
++/*
++ * Check each possible recovery conflict reason.
++ */
++static void
++ProcessRecoveryConflictInterrupts(void)
++{
++ ProcSignalReason reason;
+
+ /*
+- * Set the process latch. This function essentially emulates signal
+- * handlers like die() and StatementCancelHandler() and it seems prudent
+- * to behave similarly as they do.
++ * We don't need to worry about joggling the elbow of proc_exit, because
++ * proc_exit_prepare() holds interrupts, so ProcessInterrupts() won't call
++ * us.
+ */
+- SetLatch(MyLatch);
++ Assert(!proc_exit_inprogress);
++ Assert(InterruptHoldoffCount == 0);
++ Assert(RecoveryConflictPending);
+
+- errno = save_errno;
++ RecoveryConflictPending = false;
++
++ for (reason = PROCSIG_RECOVERY_CONFLICT_FIRST;
++ reason <= PROCSIG_RECOVERY_CONFLICT_LAST;
++ reason++)
++ {
++ if (RecoveryConflictPendingReasons[reason])
++ {
++ RecoveryConflictPendingReasons[reason] = false;
++ ProcessRecoveryConflictInterrupt(reason);
++ }
++ }
+ }
+
+ /*
+@@ -3231,24 +3291,6 @@ ProcessInterrupts(void)
+ */
+ proc_exit(1);
+ }
+- else if (RecoveryConflictPending && RecoveryConflictRetryable)
+- {
+- pgstat_report_recovery_conflict(RecoveryConflictReason);
+- ereport(FATAL,
+- (errcode(ERRCODE_T_R_SERIALIZATION_FAILURE),
+- errmsg("terminating connection due to conflict with recovery"),
+- errdetail_recovery_conflict()));
+- }
+- else if (RecoveryConflictPending)
+- {
+- /* Currently there is only one non-retryable recovery conflict */
+- Assert(RecoveryConflictReason == PROCSIG_RECOVERY_CONFLICT_DATABASE);
+- pgstat_report_recovery_conflict(RecoveryConflictReason);
+- ereport(FATAL,
+- (errcode(ERRCODE_DATABASE_DROPPED),
+- errmsg("terminating connection due to conflict with recovery"),
+- errdetail_recovery_conflict()));
+- }
+ else if (IsBackgroundWorker)
+ ereport(FATAL,
+ (errcode(ERRCODE_ADMIN_SHUTDOWN),
+@@ -3291,31 +3333,13 @@ ProcessInterrupts(void)
+ errmsg("connection to client lost")));
+ }
+
+- /*
+- * If a recovery conflict happens while we are waiting for input from the
+- * client, the client is presumably just sitting idle in a transaction,
+- * preventing recovery from making progress. Terminate the connection to
+- * dislodge it.
+- */
+- if (RecoveryConflictPending && DoingCommandRead)
+- {
+- QueryCancelPending = false; /* this trumps QueryCancel */
+- RecoveryConflictPending = false;
+- LockErrorCleanup();
+- pgstat_report_recovery_conflict(RecoveryConflictReason);
+- ereport(FATAL,
+- (errcode(ERRCODE_T_R_SERIALIZATION_FAILURE),
+- errmsg("terminating connection due to conflict with recovery"),
+- errdetail_recovery_conflict(),
+- errhint("In a moment you should be able to reconnect to the"
+- " database and repeat your command.")));
+- }
+-
+ /*
+ * Don't allow query cancel interrupts while reading input from the
+ * client, because we might lose sync in the FE/BE protocol. (Die
+ * interrupts are OK, because we won't read any further messages from the
+ * client in that case.)
++ *
++ * See similar logic in ProcessRecoveryConflictInterrupts().
+ */
+ if (QueryCancelPending && QueryCancelHoldoffCount != 0)
+ {
+@@ -3374,16 +3398,6 @@ ProcessInterrupts(void)
+ (errcode(ERRCODE_QUERY_CANCELED),
+ errmsg("canceling autovacuum task")));
+ }
+- if (RecoveryConflictPending)
+- {
+- RecoveryConflictPending = false;
+- LockErrorCleanup();
+- pgstat_report_recovery_conflict(RecoveryConflictReason);
+- ereport(ERROR,
+- (errcode(ERRCODE_T_R_SERIALIZATION_FAILURE),
+- errmsg("canceling statement due to conflict with recovery"),
+- errdetail_recovery_conflict()));
+- }
+
+ /*
+ * If we are reading a command from the client, just ignore the cancel
+@@ -3399,6 +3413,9 @@ ProcessInterrupts(void)
+ }
+ }
+
++ if (RecoveryConflictPending)
++ ProcessRecoveryConflictInterrupts();
++
+ if (IdleInTransactionSessionTimeoutPending)
+ {
+ /*
+diff --git a/src/include/storage/procsignal.h b/src/include/storage/procsignal.h
+index 2f52100b00..3a3a7eca77 100644
+--- a/src/include/storage/procsignal.h
++++ b/src/include/storage/procsignal.h
+@@ -38,13 +38,15 @@ typedef enum
+ PROCSIG_PARALLEL_APPLY_MESSAGE, /* Message from parallel apply workers */
+
+ /* Recovery conflict reasons */
+- PROCSIG_RECOVERY_CONFLICT_DATABASE,
++ PROCSIG_RECOVERY_CONFLICT_FIRST,
++ PROCSIG_RECOVERY_CONFLICT_DATABASE = PROCSIG_RECOVERY_CONFLICT_FIRST,
+ PROCSIG_RECOVERY_CONFLICT_TABLESPACE,
+ PROCSIG_RECOVERY_CONFLICT_LOCK,
+ PROCSIG_RECOVERY_CONFLICT_SNAPSHOT,
+ PROCSIG_RECOVERY_CONFLICT_LOGICALSLOT,
+ PROCSIG_RECOVERY_CONFLICT_BUFFERPIN,
+ PROCSIG_RECOVERY_CONFLICT_STARTUP_DEADLOCK,
++ PROCSIG_RECOVERY_CONFLICT_LAST = PROCSIG_RECOVERY_CONFLICT_STARTUP_DEADLOCK,
+
+ NUM_PROCSIGNALS /* Must be last! */
+ } ProcSignalReason;
+diff --git a/src/include/tcop/tcopprot.h b/src/include/tcop/tcopprot.h
+index abd7b4fff3..ab43b638ee 100644
+--- a/src/include/tcop/tcopprot.h
++++ b/src/include/tcop/tcopprot.h
+@@ -70,8 +70,7 @@ extern void die(SIGNAL_ARGS);
+ extern void quickdie(SIGNAL_ARGS) pg_attribute_noreturn();
+ extern void StatementCancelHandler(SIGNAL_ARGS);
+ extern void FloatExceptionHandler(SIGNAL_ARGS) pg_attribute_noreturn();
+-extern void RecoveryConflictInterrupt(ProcSignalReason reason); /* called from SIGUSR1
+- * handler */
++extern void HandleRecoveryConflictInterrupt(ProcSignalReason reason);
+ extern void ProcessClientReadInterrupt(bool blocked);
+ extern void ProcessClientWriteInterrupt(bool blocked);
+
+--
+2.41.0
+
diff --git a/debian/po/POTFILES.in b/debian/po/POTFILES.in
new file mode 100644
index 0000000..ebb2ac3
--- /dev/null
+++ b/debian/po/POTFILES.in
@@ -0,0 +1 @@
+[type: gettext/rfc822deb] postgresql-16.templates
diff --git a/debian/po/de.po b/debian/po/de.po
new file mode 100644
index 0000000..df2bd4d
--- /dev/null
+++ b/debian/po/de.po
@@ -0,0 +1,37 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the postgresql-11 package.
+# Copyright (C) Helge Kreutzmann <debian@helgefjell.de>, 2019.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: postgresql-11 11.1-2\n"
+"Report-Msgid-Bugs-To: postgresql-11@packages.debian.org\n"
+"POT-Creation-Date: 2019-01-09 15:22+0100\n"
+"PO-Revision-Date: 2019-01-19 07:33+0100\n"
+"Last-Translator: Helge Kreutzmann <debian@helgefjell.de>\n"
+"Language-Team: German <debian-l10n-german@lists.debian.org>\n"
+"Language: de\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#. Type: boolean
+#. Description
+#: ../postgresql-11.templates:1001
+msgid "Remove PostgreSQL directories when package is purged?"
+msgstr ""
+"PostgreSQL-Verzeichnisse entfernen, wenn das Paket endgültig gelöscht wird?"
+
+#. Type: boolean
+#. Description
+#: ../postgresql-11.templates:1001
+msgid ""
+"Removing the PostgreSQL server package will leave existing database clusters "
+"intact, i.e. their configuration, data, and log directories will not be "
+"removed. On purging the package, the directories can optionally be removed."
+msgstr ""
+"Beim Entfernen der PostgreSQL-Server-Pakete werden existierende Datenbank-"
+"Cluster intakt gelassen, d.h. ihre Konfigurations-, Daten- und "
+"Log-Verzeichnisse werden nicht entfernt. Beim endgültigen Löschen des "
+"Pakets können die Verzeichnisse optional entfernt werden."
diff --git a/debian/po/es.po b/debian/po/es.po
new file mode 100644
index 0000000..d408e65
--- /dev/null
+++ b/debian/po/es.po
@@ -0,0 +1,58 @@
+# postgresql-13 po-debconf translation to Spanish.
+# Copyright (C) 2021 Software in the Public Interest
+# This file is distributed under the same license as the postgresql-13 package.
+#
+# Changes:
+# - Initial translation
+# Jonathan Bustillos <jathan@debian.org>, 2021.
+#
+# Traductores, si no conocen el formato PO, merece la pena leer la
+# documentación de gettext, especialmente las secciones dedicadas a este
+# formato, por ejemplo ejecutando:
+# info -n '(gettext)PO Files'
+# info -n '(gettext)Header Entry'
+#
+# Equipo de traducción al español, por favor lean antes de traducir
+# los siguientes documentos:
+#
+# - El proyecto de traducción de Debian al español
+# http://www.debian.org/intl/spanish/
+# especialmente las notas y normas de traducción en
+# http://www.debian.org/intl/spanish/notas
+#
+# - La guía de traducción de po's de debconf:
+# /usr/share/doc/po-debconf/README-trans
+# o http://www.debian.org/intl/l10n/po-debconf/README-trans
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2021-03-31 18:37+0000\n"
+"PO-Revision-Date: 2021-04-03 14:25-0600\n"
+"Last-Translator: Jonathan Bustillos <jathan@debian.org>\n"
+"Language-Team: Debian Spanish <debian-l10n-spanish@lists.debian.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+"X-Generator: Gtranslator 2.91.7\n"
+
+#. Type: boolean
+#. Description
+#: ../postgresql-13.templates:1001
+msgid "Remove PostgreSQL directories when package is purged?"
+msgstr "¿Eliminar los directorios de PostgreSQL cuando se purga el paquete?"
+
+#. Type: boolean
+#. Description
+#: ../postgresql-13.templates:1001
+msgid ""
+"Removing the PostgreSQL server package will leave existing database clusters "
+"intact, i.e. their configuration, data, and log directories will not be "
+"removed. On purging the package, the directories can optionally be removed."
+msgstr ""
+"La eliminación del paquete del servidor PostgreSQL dejará intactos los "
+"clusters de bases de datos existentes, es decir, no se eliminarán sus "
+"directorios de configuración, datos y registro. Al purgar el paquete, los "
+"directorios pueden ser eliminados opcionalmente."
diff --git a/debian/po/fr.po b/debian/po/fr.po
new file mode 100644
index 0000000..cc3c6ee
--- /dev/null
+++ b/debian/po/fr.po
@@ -0,0 +1,39 @@
+# Translation of postgresql debconf templates to French
+# Copyright (C) 2019 Debian French l10n team <debian-l10n-french@lists.debian.org>
+# This file is distributed under the same license as the postgresql-11 package.
+#
+# Jean-Pierre Giraud <jean-pierregiraud@neuf.fr>, 2019.
+msgid ""
+msgstr ""
+"Project-Id-Version: postgresql-11\n"
+"Report-Msgid-Bugs-To: postgresql-11@packages.debian.org\n"
+"POT-Creation-Date: 2019-01-09 15:22+0100\n"
+"PO-Revision-Date: 2019-01-14 14:25+0100\n"
+"Last-Translator: Jean-Pierre Giraud <jean-pierregiraud@neuf.fr>\n"
+"Language-Team: French <debian-l10n-french@lists.debian.org>\n"
+"Language: fr\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n > 1);\n"
+"X-Generator: Lokalize 2.0\n"
+
+#. Type: boolean
+#. Description
+#: ../postgresql-11.templates:1001
+msgid "Remove PostgreSQL directories when package is purged?"
+msgstr ""
+"Faut-il supprimer les répertoires de PostgreSQL lors de la purge du paquet ?"
+
+#. Type: boolean
+#. Description
+#: ../postgresql-11.templates:1001
+msgid ""
+"Removing the PostgreSQL server package will leave existing database clusters "
+"intact, i.e. their configuration, data, and log directories will not be "
+"removed. On purging the package, the directories can optionally be removed."
+msgstr ""
+"La suppression du paquet du serveur PostgreSQL laissera les grappes de bases "
+"de données existantes intactes, c'est-à-dire que leurs répertoires de "
+"configuration, de données et de journal ne seront pas supprimés. Lors de la "
+"purge du paquet, les répertoires peuvent être supprimés de façon optionnelle."
diff --git a/debian/po/it.po b/debian/po/it.po
new file mode 100644
index 0000000..d8020b9
--- /dev/null
+++ b/debian/po/it.po
@@ -0,0 +1,37 @@
+# postgresql-14 Italian translation.
+# Copyright (C) 2022 postgresql-14's copyright holder
+# This file is distributed under the same license as the postgresql-14 package.
+# Ceppo <ceppo@oziosi.org>, 2022.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: postgresql-14\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2022-08-23 19:57+0000\n"
+"PO-Revision-Date: 2022-08-23 00:00+0000\n"
+"Last-Translator: Ceppo <ceppo@oziosi.org>\n"
+"Language-Team: Italian <debian-l10n-italian@lists.debian.org>\n"
+"Language: it\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#. Type: boolean
+#. Description
+#: ../postgresql-14.templates:1001
+msgid "Remove PostgreSQL directories when package is purged?"
+msgstr "Rimuovere le directory di PostgreSQL quando viene eseguito il purge "
+"del pacchetto?"
+
+#. Type: boolean
+#. Description
+#: ../postgresql-14.templates:1001
+msgid ""
+"Removing the PostgreSQL server package will leave existing database clusters "
+"intact, i.e. their configuration, data, and log directories will not be "
+"removed. On purging the package, the directories can optionally be removed."
+msgstr ""
+"La rimozione del pacchetto server di PostgreSQL lascerà intatti i cluster "
+"di database esistenti, cioè i loro dati, configurazione e directory di log "
+"non saranno rimossi. Eseguendo il purge del pacchetto, le directory possono "
+"opzionalmente essere rimosse."
diff --git a/debian/po/nl.po b/debian/po/nl.po
new file mode 100644
index 0000000..11cda87
--- /dev/null
+++ b/debian/po/nl.po
@@ -0,0 +1,40 @@
+# Dutch translation of postgresql-11 debconf templates.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the postgresql-11 package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+# Frans Spiesschaert <Frans.Spiesschaert@yucom.be>, 2019.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: postgresql-11_11.1-2\n"
+"Report-Msgid-Bugs-To: postgresql-11@packages.debian.org\n"
+"POT-Creation-Date: 2019-01-09 15:22+0100\n"
+"PO-Revision-Date: 2019-01-19 10:43+0100\n"
+"Last-Translator: Frans Spiesschaert <Frans.Spiesschaert@yucom.be>\n"
+"Language-Team: Debian Dutch l10n Team <debian-l10n-dutch@lists.debian.org>\n"
+"Language: nl\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+"X-Generator: Gtranslator 2.91.7\n"
+
+#. Type: boolean
+#. Description
+#: ../postgresql-11.templates:1001
+msgid "Remove PostgreSQL directories when package is purged?"
+msgstr ""
+"De PostgreSQL-mappen verwijderen wanneer het pakket gewist (purged) wordt?"
+
+#. Type: boolean
+#. Description
+#: ../postgresql-11.templates:1001
+msgid ""
+"Removing the PostgreSQL server package will leave existing database clusters "
+"intact, i.e. their configuration, data, and log directories will not be "
+"removed. On purging the package, the directories can optionally be removed."
+msgstr ""
+"Bij het verwijderen van het serverpakket van PostgreSQL blijven de bestaande "
+"databaseclusters intact. Dit wil zeggen dat hun configuratie-, gegevens- en "
+"logboekmappen niet verwijderd worden. Bij het wissen (purge) van het pakket, "
+"kunnen de mappen naar keuze verwijderd worden."
diff --git a/debian/po/pt.po b/debian/po/pt.po
new file mode 100644
index 0000000..ee294d1
--- /dev/null
+++ b/debian/po/pt.po
@@ -0,0 +1,39 @@
+# Translation of postgresql-11's debconf messages to European Portuguese
+# Copyright (C) 2019 THE postgresql-11'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the postgresql-11 package.
+#
+# Américo Monteiro <a_monteiro@gmx.com>, 2019.
+msgid ""
+msgstr ""
+"Project-Id-Version: postgresql-11 11.1-2\n"
+"Report-Msgid-Bugs-To: postgresql-11@packages.debian.org\n"
+"POT-Creation-Date: 2019-01-09 15:22+0100\n"
+"PO-Revision-Date: 2019-01-15 00:34+0000\n"
+"Last-Translator: Américo Monteiro <a_monteiro@gmx.com>\n"
+"Language-Team: Portuguese <>\n"
+"Language: pt\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+"X-Generator: Lokalize 2.0\n"
+
+#. Type: boolean
+#. Description
+#: ../postgresql-11.templates:1001
+msgid "Remove PostgreSQL directories when package is purged?"
+msgstr "Remover os directórios do PostgreSQL quando o pacote for purgado?"
+
+#. Type: boolean
+#. Description
+#: ../postgresql-11.templates:1001
+msgid ""
+"Removing the PostgreSQL server package will leave existing database clusters "
+"intact, i.e. their configuration, data, and log directories will not be "
+"removed. On purging the package, the directories can optionally be removed."
+msgstr ""
+"Remover o pacote do servidor PostgreSQL irá deixar intactos agrupamentos de "
+"bases de dados existentes, isto é, a sua configuração, dados, e relatórios "
+"são serão removidos. Ao purgar o pacote, estes directórios podem "
+"opcionalmente ser removidos."
+
diff --git a/debian/po/pt_BR.po b/debian/po/pt_BR.po
new file mode 100644
index 0000000..5e746cf
--- /dev/null
+++ b/debian/po/pt_BR.po
@@ -0,0 +1,37 @@
+# Debconf translations for postgresql-11.
+# Copyright (C) 2019 THE postgresql-11'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the postgresql-11 package.
+# Adriano Rafael Gomes <adrianorg@debian.org>, 2019.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: postgresql-11\n"
+"Report-Msgid-Bugs-To: postgresql-11@packages.debian.org\n"
+"POT-Creation-Date: 2019-01-09 15:22+0100\n"
+"PO-Revision-Date: 2019-01-19 18:06-0200\n"
+"Last-Translator: Adriano Rafael Gomes <adrianorg@debian.org>\n"
+"Language-Team: Brazilian Portuguese <debian-l10n-portuguese@lists.debian."
+"org>\n"
+"Language: pt_BR\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#. Type: boolean
+#. Description
+#: ../postgresql-11.templates:1001
+msgid "Remove PostgreSQL directories when package is purged?"
+msgstr "Remover diretórios do PostgreSQL ao expurgar o pacote?"
+
+#. Type: boolean
+#. Description
+#: ../postgresql-11.templates:1001
+msgid ""
+"Removing the PostgreSQL server package will leave existing database clusters "
+"intact, i.e. their configuration, data, and log directories will not be "
+"removed. On purging the package, the directories can optionally be removed."
+msgstr ""
+"Remover o pacote do servidor PostgreSQL deixará os \"clusters\" de bancos de "
+"dados existentes intactos, ou seja, suas configurações, dados e diretórios "
+"de log não serão removidos. Ao expurgar o pacote, os diretórios podem ser "
+"opcionalmente removidos."
diff --git a/debian/po/ro.po b/debian/po/ro.po
new file mode 100644
index 0000000..f38fc55
--- /dev/null
+++ b/debian/po/ro.po
@@ -0,0 +1,50 @@
+# Mesajele în limba română pentru pachetul postgresql.
+# translation of postgresql-xx_ro.po to Romanian
+# Copyright © 2023 THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the postgresql package.
+#
+# Remus-Gabriel Chelu <remusgabriel.chelu@disroot.org>, 2023.
+#
+# Cronologia traducerii fișierului „postgresql”:
+# Traducerea inițială, făcută de R-GC, pentru versiunea postgresql-15_15.1-1.
+# Actualizare a traducerii pentru versiunea Y, făcută de X, Y(anul).
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: postgresql-15 15.1-1\n"
+"Report-Msgid-Bugs-To: postgresql-15@packages.debian.org\n"
+"POT-Creation-Date: 2023-01-19 20:42+0000\n"
+"PO-Revision-Date: 2023-02-12 17:42+0100\n"
+"Last-Translator: Remus-Gabriel Chelu <remusgabriel.chelu@disroot.org>\n"
+"Language-Team: Romanian <debian-l10n-romanian@lists.debian.org>\n"
+"Language: ro\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n==0 || (n!=1 && n%100>=1 && "
+"n%100<=19) ? 1 : 2);\n"
+"X-Generator: Poedit 3.2.2\n"
+
+#. Type: boolean
+#. Description
+#: ../postgresql-15.templates:1001
+msgid "Remove PostgreSQL directories when package is purged?"
+msgstr "Eliminați directoarele PostgreSQL atunci când pachetul este înlăturat?"
+
+# R-GC, scrie:
+# la sugestia lui DȘ, am modificat traducerea
+# acestui mesaj, de la:
+# „... va lăsa intacte clusterele de baze de date existente, ...”, la:
+# „... va lăsa intacte grupurile de servere (clusters) de baze de date existente, ...”
+#. Type: boolean
+#. Description
+#: ../postgresql-15.templates:1001
+msgid ""
+"Removing the PostgreSQL server package will leave existing database clusters "
+"intact, i.e. their configuration, data, and log directories will not be "
+"removed. On purging the package, the directories can optionally be removed."
+msgstr ""
+"Eliminarea pachetului de server PostgreSQL va lăsa intacte grupurile de servere "
+"(clusters) de baze de date existente, adică configurația, datele și "
+"directoarele lor de jurnal nu vor fi eliminate. La înlăturarea pachetului, "
+"directoarele pot fi eliminate opțional."
diff --git a/debian/po/ru.po b/debian/po/ru.po
new file mode 100644
index 0000000..9828439
--- /dev/null
+++ b/debian/po/ru.po
@@ -0,0 +1,39 @@
+# Russian translation of debconf template for postgresql-11
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the postgresql-11 package.
+# Lev Lamberov <dogsleg@debian.org>, 2019
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: postgresql-11\n"
+"Report-Msgid-Bugs-To: postgresql-11@packages.debian.org\n"
+"POT-Creation-Date: 2019-01-09 15:22+0100\n"
+"PO-Revision-Date: 2019-01-27 14:56+0500\n"
+"Language-Team: Debian L10N Russian <debian-l10n-russian@lists.debian.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: Poedit 2.2.1\n"
+"Last-Translator: Lev Lamberov <dogsleg@debian.org>\n"
+"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
+"%10<=4 && (n%100<12 || n%100>14) ? 1 : 2);\n"
+"Language: ru\n"
+
+#. Type: boolean
+#. Description
+#: ../postgresql-11.templates:1001
+msgid "Remove PostgreSQL directories when package is purged?"
+msgstr "Удалить каталоги PostgreSQL при вычищении пакета?"
+
+#. Type: boolean
+#. Description
+#: ../postgresql-11.templates:1001
+msgid ""
+"Removing the PostgreSQL server package will leave existing database clusters "
+"intact, i.e. their configuration, data, and log directories will not be "
+"removed. On purging the package, the directories can optionally be removed."
+msgstr ""
+"При удалении серверного пакета PostgreSQL существующие кластеры баз данных "
+"останутся нетронутыми. То есть, их каталоги с настройками, данными и "
+"журналами не будут удалены. При вычистке пакета эти каталоги могут быть при "
+"необходимости удалены."
diff --git a/debian/po/sv.po b/debian/po/sv.po
new file mode 100644
index 0000000..0f9120f
--- /dev/null
+++ b/debian/po/sv.po
@@ -0,0 +1,36 @@
+# Translation of postgresql-16 debconf template to Swedish
+# Copyright (C) 2023 Martin Bagge <brother@persilja.net>
+# This file is distributed under the same license as the postgresql-16 package.
+#
+# Martin Bagge <brother@persilja.net>, 2023
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: postgresql-16@packages.debian.org\n"
+"POT-Creation-Date: 2023-12-21 17:22+0100\n"
+"PO-Revision-Date: 2023-12-20 22:17+0100\n"
+"Last-Translator: Martin Bagge <brother@persilja.net>\n"
+"Language-Team: Swedish <debian-l10n-swedish@lists.debian.org>\n"
+"Language: sv\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#. Type: boolean
+#. Description
+#: ../postgresql-16.templates:1001
+msgid "Remove PostgreSQL directories when package is purged?"
+msgstr "Ska sökvägar för PostgreSQL tas bort när paketet rensas bort helt?"
+
+#. Type: boolean
+#. Description
+#: ../postgresql-16.templates:1001
+msgid ""
+"Removing the PostgreSQL server package will leave existing database clusters "
+"intact, i.e. their configuration, data, and log directories will not be "
+"removed. On purging the package, the directories can optionally be removed."
+msgstr ""
+"När serverpaketet för PostgreSQL tas bort lämnas existerande databaskluster "
+"kvar i sin helhet - det vill säga inställnings-, data- och logg-kataloger "
+"kommer inte tas bort. När ett paket rensas bort helt (purge) kan katalogerna "
+"tas bort automatiskt om så önskas."
diff --git a/debian/po/templates.pot b/debian/po/templates.pot
new file mode 100644
index 0000000..8cdb85c
--- /dev/null
+++ b/debian/po/templates.pot
@@ -0,0 +1,33 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the postgresql-11 package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: postgresql-11\n"
+"Report-Msgid-Bugs-To: postgresql-11@packages.debian.org\n"
+"POT-Creation-Date: 2019-01-09 15:22+0100\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#. Type: boolean
+#. Description
+#: ../postgresql-11.templates:1001
+msgid "Remove PostgreSQL directories when package is purged?"
+msgstr ""
+
+#. Type: boolean
+#. Description
+#: ../postgresql-11.templates:1001
+msgid ""
+"Removing the PostgreSQL server package will leave existing database clusters "
+"intact, i.e. their configuration, data, and log directories will not be "
+"removed. On purging the package, the directories can optionally be removed."
+msgstr ""
diff --git a/debian/postgresql-16.install b/debian/postgresql-16.install
new file mode 100755
index 0000000..2789e3a
--- /dev/null
+++ b/debian/postgresql-16.install
@@ -0,0 +1,57 @@
+#!/usr/bin/dh-exec
+
+usr/lib/postgresql/*/bin/initdb
+usr/lib/postgresql/*/bin/oid2name
+usr/lib/postgresql/*/bin/pg_archivecleanup
+usr/lib/postgresql/*/bin/pgbench
+usr/lib/postgresql/*/bin/pg_checksums
+usr/lib/postgresql/*/bin/pg_controldata
+usr/lib/postgresql/*/bin/pg_ctl
+usr/lib/postgresql/*/bin/pg_resetwal
+usr/lib/postgresql/*/bin/pg_rewind
+usr/lib/postgresql/*/bin/pg_test_fsync
+usr/lib/postgresql/*/bin/pg_test_timing
+usr/lib/postgresql/*/bin/pg_upgrade
+usr/lib/postgresql/*/bin/pg_waldump
+usr/lib/postgresql/*/bin/postgres
+usr/lib/postgresql/*/bin/vacuumlo
+[!alpha !hppa !hurd-i386 !ia64 !kfreebsd-amd64 !kfreebsd-i386 !loong64 !m68k !powerpc !riscv64 !sh4 !sparc64 !x32] usr/lib/postgresql/*/lib/bitcode
+[!alpha !hppa !hurd-i386 !ia64 !kfreebsd-amd64 !kfreebsd-i386 !loong64 !m68k !powerpc !riscv64 !sh4 !sparc64 !x32] usr/lib/postgresql/*/lib/llvmjit_types.bc
+usr/lib/postgresql/*/lib/*.so
+usr/share/locale/*/LC_MESSAGES/initdb-*.mo
+usr/share/locale/*/LC_MESSAGES/pg_archivecleanup-*.mo
+usr/share/locale/*/LC_MESSAGES/pg_checksums-*.mo
+usr/share/locale/*/LC_MESSAGES/pg_controldata-*.mo
+usr/share/locale/*/LC_MESSAGES/pg_ctl-*.mo
+usr/share/locale/*/LC_MESSAGES/pg_resetwal-*.mo
+usr/share/locale/*/LC_MESSAGES/pg_rewind-*.mo
+usr/share/locale/*/LC_MESSAGES/pg_test_fsync-*.mo
+usr/share/locale/*/LC_MESSAGES/pg_test_timing-*.mo
+usr/share/locale/*/LC_MESSAGES/pg_upgrade-*.mo
+usr/share/locale/*/LC_MESSAGES/pg_waldump-*.mo
+usr/share/locale/*/LC_MESSAGES/postgres-*.mo
+usr/share/locale/*/LC_MESSAGES/plpgsql-*.mo
+[linux-any] usr/share/postgresql/*/contrib/sepgsql.sql
+usr/share/postgresql/*/errcodes.txt
+usr/share/postgresql/*/extension/*
+usr/share/postgresql/*/man/man1/initdb.1*
+usr/share/postgresql/*/man/man1/oid2name.1*
+usr/share/postgresql/*/man/man1/pg_archivecleanup.1*
+usr/share/postgresql/*/man/man1/pgbench.1*
+usr/share/postgresql/*/man/man1/pg_checksums.1*
+usr/share/postgresql/*/man/man1/pg_controldata.1*
+usr/share/postgresql/*/man/man1/pg_ctl.1*
+usr/share/postgresql/*/man/man1/pg_resetwal.1*
+usr/share/postgresql/*/man/man1/pg_rewind.1*
+usr/share/postgresql/*/man/man1/pg_test_fsync.1*
+usr/share/postgresql/*/man/man1/pg_test_timing.1*
+usr/share/postgresql/*/man/man1/pg_upgrade.1*
+usr/share/postgresql/*/man/man1/pg_waldump.1*
+usr/share/postgresql/*/man/man1/postgres.1*
+usr/share/postgresql/*/man/man1/vacuumlo.1*
+usr/share/postgresql/*/timezonesets/*
+usr/share/postgresql/*/tsearch_data
+usr/share/postgresql/*/*.sql
+usr/share/postgresql/*/*.conf.sample
+usr/share/postgresql/*/postgres.bki
+usr/share/postgresql/*/sql_features.txt
diff --git a/debian/postgresql-16.lintian-overrides b/debian/postgresql-16.lintian-overrides
new file mode 100644
index 0000000..db59083
--- /dev/null
+++ b/debian/postgresql-16.lintian-overrides
@@ -0,0 +1,20 @@
+# We test for /usr/bin/pg_dropcluster, but run it without path
+command-with-path-in-maintainer-script
+
+# The World's Most Advanced Open Source Relational Database
+description-synopsis-starts-with-article
+
+# We ship binaries and libs in subdirs of /usr/lib/postgresql
+executable-in-usr-lib
+repeated-path-segment lib *
+
+# These are PostgreSQL server plugins; some need no external libraries
+hardening-no-fortify-functions [usr/lib/postgresql/*/lib/*]
+library-not-linked-against-libc [usr/lib/postgresql/*/lib/*]
+shared-library-lacks-prerequisites [usr/lib/postgresql/*/lib/*]
+
+# We use debconf in postrm only
+no-debconf-config
+
+# We store the PostgreSQL catalog version in a custom control field
+unknown-field *Postgresql-Catversion
diff --git a/debian/postgresql-16.postinst b/debian/postgresql-16.postinst
new file mode 100644
index 0000000..be69843
--- /dev/null
+++ b/debian/postgresql-16.postinst
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+set -e
+
+VERSION=${DPKG_MAINTSCRIPT_PACKAGE##*-}
+
+if [ "$1" = configure ]; then
+ . /usr/share/postgresql-common/maintscripts-functions
+
+ configure_version $VERSION "$2"
+fi
+
+#DEBHELPER#
diff --git a/debian/postgresql-16.postrm b/debian/postgresql-16.postrm
new file mode 100644
index 0000000..c9f8893
--- /dev/null
+++ b/debian/postgresql-16.postrm
@@ -0,0 +1,80 @@
+#!/bin/sh
+
+set -e
+
+VERSION=${DPKG_MAINTSCRIPT_PACKAGE##*-}
+
+clean_dir() {
+ if [ -d "$1" ] && [ ! -L "$1" ]; then
+ rmdir "$1" >/dev/null 2>/dev/null || true
+ fi
+}
+
+drop_cluster() {
+ # if we still have the postgresql-common package, use it to also shutdown
+ # server, etc.; otherwise just remove the directories
+ if [ -x /usr/bin/pg_dropcluster ]; then
+ pg_dropcluster --stop-server $VERSION "$1"
+ else
+ # remove data directory
+ PGDATALINK="/etc/postgresql/$VERSION/$1/pgdata"
+ if [ -e "$PGDATALINK" ]; then
+ rm -rf $(readlink -f "$PGDATALINK") "$PGDATALINK"
+ else
+ rm -rf "/var/lib/postgresql/$VERSION/$1/"
+ fi
+
+ # remove log file, including rotated ones
+ LOGLINK="/etc/postgresql/$VERSION/$1/log"
+ if [ -e "$LOGLINK" ]; then
+ LOG=$(readlink -f "$LOGLINK")
+ rm -f $LOG* "$LOGLINK"
+ else
+ rm -f /var/log/postgresql/postgresql-$VERSION-"$1".log*
+ fi
+
+ # remove conffiles
+ for f in pg_hba.conf pg_ident.conf postgresql.conf start.conf environment pg_ctl.conf; do
+ rm -f /etc/postgresql/$VERSION/"$1"/$f
+ done
+ # remove empty conf.d directories
+ for d in /etc/postgresql/$VERSION/"$1"/*/; do
+ clean_dir "$d"
+ done
+
+ clean_dir /etc/postgresql/$VERSION/"$1"
+ fi
+}
+
+purge_package () {
+ # ask the user if they want to remove clusters. If debconf is not
+ # available, just remove everything
+ if [ -e /usr/share/debconf/confmodule ]; then
+ db_set $DPKG_MAINTSCRIPT_PACKAGE/postrm_purge_data true
+ db_input high $DPKG_MAINTSCRIPT_PACKAGE/postrm_purge_data || :
+ db_go || :
+ db_get $DPKG_MAINTSCRIPT_PACKAGE/postrm_purge_data || :
+ [ "$RET" = "false" ] && return 0
+ fi
+
+ for c in /etc/postgresql/$VERSION/*; do
+ [ -e "$c/postgresql.conf" ] || continue
+ cluster=$(basename "$c")
+ echo "Dropping cluster $cluster..."
+ drop_cluster "$cluster"
+ done
+
+ clean_dir /etc/postgresql/$VERSION
+ clean_dir /var/lib/postgresql/$VERSION
+ clean_dir /var/log/postgresql/$VERSION
+}
+
+if [ "$1" = purge ] && [ -d "/etc/postgresql/$VERSION" ] && [ "$(ls /etc/postgresql/$VERSION)" ]; then
+ # can't load debconf from a function
+ if [ -e /usr/share/debconf/confmodule ]; then
+ . /usr/share/debconf/confmodule
+ fi
+ purge_package
+fi
+
+#DEBHELPER#
diff --git a/debian/postgresql-16.preinst b/debian/postgresql-16.preinst
new file mode 100644
index 0000000..a1bccbc
--- /dev/null
+++ b/debian/postgresql-16.preinst
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+set -e
+
+MAJOR_VER="${DPKG_MAINTSCRIPT_PACKAGE#postgresql-}"
+CATVERSION="@CATVERSION@" # set by override_dh_installdeb
+
+case $1 in
+ install|upgrade)
+ if [ "$2" ]; then
+ . /usr/share/postgresql-common/maintscripts-functions
+ preinst_check_catversion "$MAJOR_VER" "$CATVERSION"
+ fi ;;
+esac
+
+#DEBHELPER#
+
+exit 0
diff --git a/debian/postgresql-16.prerm b/debian/postgresql-16.prerm
new file mode 100644
index 0000000..828c6fb
--- /dev/null
+++ b/debian/postgresql-16.prerm
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+set -e
+
+VERSION=${DPKG_MAINTSCRIPT_PACKAGE##*-}
+
+#DEBHELPER#
+
+. /usr/share/postgresql-common/maintscripts-functions
+
+stop_version $VERSION
+
+if [ "$1" = remove ]; then
+ remove_version $VERSION
+fi
+
diff --git a/debian/postgresql-16.templates b/debian/postgresql-16.templates
new file mode 100644
index 0000000..41b8e45
--- /dev/null
+++ b/debian/postgresql-16.templates
@@ -0,0 +1,7 @@
+Template: postgresql-16/postrm_purge_data
+Type: boolean
+Default: true
+_Description: Remove PostgreSQL directories when package is purged?
+ Removing the PostgreSQL server package will leave existing database clusters
+ intact, i.e. their configuration, data, and log directories will not be
+ removed. On purging the package, the directories can optionally be removed.
diff --git a/debian/postgresql-client-16.install b/debian/postgresql-client-16.install
new file mode 100644
index 0000000..098585b
--- /dev/null
+++ b/debian/postgresql-client-16.install
@@ -0,0 +1,45 @@
+usr/lib/postgresql/*/bin/clusterdb
+usr/lib/postgresql/*/bin/createdb
+usr/lib/postgresql/*/bin/createuser
+usr/lib/postgresql/*/bin/dropdb
+usr/lib/postgresql/*/bin/dropuser
+usr/lib/postgresql/*/bin/pg_amcheck
+usr/lib/postgresql/*/bin/pg_basebackup
+usr/lib/postgresql/*/bin/pg_config
+usr/lib/postgresql/*/bin/pg_dump
+usr/lib/postgresql/*/bin/pg_dumpall
+usr/lib/postgresql/*/bin/pg_isready
+usr/lib/postgresql/*/bin/pg_receivewal
+usr/lib/postgresql/*/bin/pg_recvlogical
+usr/lib/postgresql/*/bin/pg_restore
+usr/lib/postgresql/*/bin/pg_verifybackup
+usr/lib/postgresql/*/bin/psql
+usr/lib/postgresql/*/bin/reindexdb
+usr/lib/postgresql/*/bin/vacuumdb
+usr/lib/postgresql/*/lib/pgxs/*
+usr/share/locale/*/LC_MESSAGES/pg_amcheck-*.mo
+usr/share/locale/*/LC_MESSAGES/pg_basebackup-*.mo
+usr/share/locale/*/LC_MESSAGES/pg_config-*.mo
+usr/share/locale/*/LC_MESSAGES/pg_dump-*.mo
+usr/share/locale/*/LC_MESSAGES/pg_verifybackup-*.mo
+usr/share/locale/*/LC_MESSAGES/pgscripts-*.mo
+usr/share/locale/*/LC_MESSAGES/psql-*.mo
+usr/share/postgresql/*/man/man1/clusterdb.1*
+usr/share/postgresql/*/man/man1/createdb.1*
+usr/share/postgresql/*/man/man1/createuser.1*
+usr/share/postgresql/*/man/man1/dropdb.1*
+usr/share/postgresql/*/man/man1/dropuser.1*
+usr/share/postgresql/*/man/man1/pg_amcheck.1*
+usr/share/postgresql/*/man/man1/pg_basebackup.1*
+usr/share/postgresql/*/man/man1/pg_dump.1*
+usr/share/postgresql/*/man/man1/pg_dumpall.1*
+usr/share/postgresql/*/man/man1/pg_isready.1*
+usr/share/postgresql/*/man/man1/pg_receivewal.1*
+usr/share/postgresql/*/man/man1/pg_recvlogical.1*
+usr/share/postgresql/*/man/man1/pg_restore.1*
+usr/share/postgresql/*/man/man1/pg_verifybackup.1*
+usr/share/postgresql/*/man/man1/psql.1*
+usr/share/postgresql/*/man/man1/reindexdb.1*
+usr/share/postgresql/*/man/man1/vacuumdb.1*
+usr/share/postgresql/*/man/man7/
+usr/share/postgresql/*/psqlrc.sample
diff --git a/debian/postgresql-client-16.lintian-overrides b/debian/postgresql-client-16.lintian-overrides
new file mode 100644
index 0000000..a3cef5b
--- /dev/null
+++ b/debian/postgresql-client-16.lintian-overrides
@@ -0,0 +1,3 @@
+# We ship binaries and libs in subdirs of /usr/lib/postgresql
+executable-in-usr-lib
+repeated-path-segment lib *
diff --git a/debian/postgresql-client-16.postinst b/debian/postgresql-client-16.postinst
new file mode 100644
index 0000000..a5cf251
--- /dev/null
+++ b/debian/postgresql-client-16.postinst
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+set -e
+
+VERSION=${DPKG_MAINTSCRIPT_PACKAGE##*-}
+
+. /usr/share/postgresql-common/maintscripts-functions
+
+if [ "$1" = configure ]; then
+ configure_client_version $VERSION "$2"
+fi
+
+#DEBHELPER#
diff --git a/debian/postgresql-client-16.prerm b/debian/postgresql-client-16.prerm
new file mode 100644
index 0000000..14c2188
--- /dev/null
+++ b/debian/postgresql-client-16.prerm
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+set -e
+
+VERSION=${DPKG_MAINTSCRIPT_PACKAGE##*-}
+
+#DEBHELPER#
+
+if [ "$1" = remove ]; then
+ . /usr/share/postgresql-common/maintscripts-functions
+ remove_client_version $VERSION
+fi
diff --git a/debian/postgresql-doc-16.doc-base b/debian/postgresql-doc-16.doc-base
new file mode 100644
index 0000000..42749e3
--- /dev/null
+++ b/debian/postgresql-doc-16.doc-base
@@ -0,0 +1,18 @@
+Document: postgresql-16
+Title: PostgreSQL 16 Documentation
+Author: The PostgreSQL Global Development Group
+Abstract: The documentation for the PostgreSQL database management system,
+ version 16. PostgreSQL is a powerful, open source object-relational database
+ system. It is fully ACID compliant, has full support for foreign keys, joins,
+ views, triggers, and stored procedures (in multiple languages). It includes
+ most SQL:2008 data types, including INTEGER, NUMERIC, BOOLEAN, CHAR, VARCHAR,
+ DATE, INTERVAL, and TIMESTAMP. It also supports storage of binary large
+ objects, including pictures, sounds, or video. It has native programming
+ interfaces for C/C++, Java, .Net, Perl, Python, Ruby, Tcl, ODBC, among others,
+ and exceptional documentation.
+Section: Data Management
+
+Format: HTML
+Index: /usr/share/doc/postgresql-doc-16/html/index.html
+Files: /usr/share/doc/postgresql-doc-16/html/*
+
diff --git a/debian/postgresql-doc-16.install b/debian/postgresql-doc-16.install
new file mode 100644
index 0000000..a41ef19
--- /dev/null
+++ b/debian/postgresql-doc-16.install
@@ -0,0 +1,2 @@
+usr/share/doc/postgresql-doc-*
+usr/share/postgresql/*/man/man3/
diff --git a/debian/postgresql-doc-16.postinst b/debian/postgresql-doc-16.postinst
new file mode 100644
index 0000000..d647cf4
--- /dev/null
+++ b/debian/postgresql-doc-16.postinst
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+set -e
+
+VERSION=${DPKG_MAINTSCRIPT_PACKAGE##*-}
+
+# arguments: version master package [package]
+__link_manpages() {
+ MANS=$(unset GREP_OPTIONS; dpkg -L $3 $4 $5 2>/dev/null | grep -E '/man/.*\.[1-9](\.gz)?$' | grep -v "$2") || true
+ [ -n "$MANS" ] || return 0
+
+ SLAVES=$(for i in $MANS; do TARGET=$(echo $i | sed "s/postgresql\/$1\///"); echo -n " --slave $TARGET $(basename $i) $i"; done)
+
+ mkdir -p /usr/share/man/man3
+ section=$(echo "$2" | sed -e 's/.*\.\(.*\)\..*/man\1/')
+ update-alternatives --install /usr/share/man/$section/$2 \
+ $2 /usr/share/postgresql/$1/man/$section/$2 \
+ ${1}0 $SLAVES
+}
+
+if [ "$1" = configure ]; then
+ if [ -f /usr/share/postgresql-common/maintscripts-functions ]; then
+ . /usr/share/postgresql-common/maintscripts-functions
+ configure_doc_version $VERSION "$2"
+ else
+ __link_manpages $VERSION SPI_connect.3.gz "postgresql-doc-$VERSION"
+ fi
+fi
+
+#DEBHELPER#
diff --git a/debian/postgresql-doc-16.prerm b/debian/postgresql-doc-16.prerm
new file mode 100644
index 0000000..9b72239
--- /dev/null
+++ b/debian/postgresql-doc-16.prerm
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+set -e
+
+VERSION=${DPKG_MAINTSCRIPT_PACKAGE##*-}
+
+if [ "$1" = remove ]; then
+ if [ -f /usr/share/postgresql-common/maintscripts-functions ]; then
+ . /usr/share/postgresql-common/maintscripts-functions
+ remove_doc_version $VERSION
+ else
+ update-alternatives --remove SPI_connect.3.gz \
+ /usr/share/postgresql/$VERSION/man/man3/SPI_connect.3.gz
+ fi
+fi
+
+#DEBHELPER#
diff --git a/debian/postgresql-plperl-16.install b/debian/postgresql-plperl-16.install
new file mode 100755
index 0000000..f32d0c0
--- /dev/null
+++ b/debian/postgresql-plperl-16.install
@@ -0,0 +1,6 @@
+#!/usr/bin/dh-exec
+
+usr/lib/postgresql/*/lib/*plperl*.so
+[!alpha !hppa !hurd-i386 !ia64 !kfreebsd-amd64 !kfreebsd-i386 !loong64 !m68k !powerpc !riscv64 !sh4 !sparc64 !x32] usr/lib/postgresql/*/lib/bitcode/*plperl*
+usr/share/locale/*/*/plperl-*.mo
+usr/share/postgresql/*/extension/*plperl*
diff --git a/debian/postgresql-plperl-16.lintian-overrides b/debian/postgresql-plperl-16.lintian-overrides
new file mode 120000
index 0000000..7bab0e9
--- /dev/null
+++ b/debian/postgresql-plperl-16.lintian-overrides
@@ -0,0 +1 @@
+postgresql-16.lintian-overrides \ No newline at end of file
diff --git a/debian/postgresql-plpython3-16.install b/debian/postgresql-plpython3-16.install
new file mode 100755
index 0000000..402bdd7
--- /dev/null
+++ b/debian/postgresql-plpython3-16.install
@@ -0,0 +1,6 @@
+#!/usr/bin/dh-exec
+
+usr/lib/postgresql/*/lib/*plpython3*.so
+[!alpha !hppa !hurd-i386 !ia64 !kfreebsd-amd64 !kfreebsd-i386 !loong64 !m68k !powerpc !riscv64 !sh4 !sparc64 !x32] usr/lib/postgresql/*/lib/bitcode/*plpython3*
+usr/share/locale/*/*/plpython-*.mo
+usr/share/postgresql/*/extension/*plpython3*
diff --git a/debian/postgresql-plpython3-16.lintian-overrides b/debian/postgresql-plpython3-16.lintian-overrides
new file mode 120000
index 0000000..7bab0e9
--- /dev/null
+++ b/debian/postgresql-plpython3-16.lintian-overrides
@@ -0,0 +1 @@
+postgresql-16.lintian-overrides \ No newline at end of file
diff --git a/debian/postgresql-pltcl-16.install b/debian/postgresql-pltcl-16.install
new file mode 100644
index 0000000..f56fc0f
--- /dev/null
+++ b/debian/postgresql-pltcl-16.install
@@ -0,0 +1,3 @@
+usr/lib/postgresql/*/lib/pltcl.so
+usr/share/locale/*/*/pltcl-*.mo
+usr/share/postgresql/*/extension/pltcl*
diff --git a/debian/postgresql-pltcl-16.lintian-overrides b/debian/postgresql-pltcl-16.lintian-overrides
new file mode 120000
index 0000000..7bab0e9
--- /dev/null
+++ b/debian/postgresql-pltcl-16.lintian-overrides
@@ -0,0 +1 @@
+postgresql-16.lintian-overrides \ No newline at end of file
diff --git a/debian/postgresql-server-dev-16.install b/debian/postgresql-server-dev-16.install
new file mode 100644
index 0000000..4c84b49
--- /dev/null
+++ b/debian/postgresql-server-dev-16.install
@@ -0,0 +1,2 @@
+usr/include/postgresql/*/server
+usr/lib/postgresql/*/lib/libpg*.a
diff --git a/debian/postgresql-server-dev-16.lintian-overrides b/debian/postgresql-server-dev-16.lintian-overrides
new file mode 120000
index 0000000..7bab0e9
--- /dev/null
+++ b/debian/postgresql-server-dev-16.lintian-overrides
@@ -0,0 +1 @@
+postgresql-16.lintian-overrides \ No newline at end of file
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..e8d808c
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,5 @@
+#!/usr/bin/make -f
+
+MAJOR_VER := 16
+
+include /usr/share/postgresql-common/server/postgresql.mk
diff --git a/debian/source/format b/debian/source/format
new file mode 100644
index 0000000..163aaf8
--- /dev/null
+++ b/debian/source/format
@@ -0,0 +1 @@
+3.0 (quilt)
diff --git a/debian/source/lintian-overrides b/debian/source/lintian-overrides
new file mode 100644
index 0000000..a244735
--- /dev/null
+++ b/debian/source/lintian-overrides
@@ -0,0 +1,4 @@
+# pregenerated docs contain some tables rendered on a single line
+source: source-is-missing [doc/src/sgml/html/*]
+# same for these, plus including some regression output files
+source: very-long-line-length-in-source-file *
diff --git a/debian/tests/Makefile.regress b/debian/tests/Makefile.regress
new file mode 100644
index 0000000..f01a80a
--- /dev/null
+++ b/debian/tests/Makefile.regress
@@ -0,0 +1,5 @@
+MODULE_big = regress
+OBJS = regress.o
+PG_CONFIG = pg_config
+PGXS = $(shell $(PG_CONFIG) --pgxs)
+include $(PGXS)
diff --git a/debian/tests/control b/debian/tests/control
new file mode 100644
index 0000000..c05e029
--- /dev/null
+++ b/debian/tests/control
@@ -0,0 +1,21 @@
+Tests: run-testsuite
+Depends:
+ build-essential,
+ debhelper,
+ fakeroot,
+ hunspell-en-us,
+ iproute2,
+ locales-all,
+ logrotate,
+ netcat-openbsd,
+ perl,
+ procps,
+ @,
+Restrictions: needs-root
+
+Tests: installcheck
+Depends:
+ build-essential,
+ tzdata-legacy | tzdata (<< 2023c-8),
+ @,
+Restrictions: allow-stderr
diff --git a/debian/tests/installcheck b/debian/tests/installcheck
new file mode 100755
index 0000000..fc390ea
--- /dev/null
+++ b/debian/tests/installcheck
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+set -eux
+
+SOURCE=$(dpkg-parsechangelog -SSource)
+MAJOR=${SOURCE#*-}
+top_srcdir=$PWD
+
+cd src/test/regress
+
+# compile regress.so
+make -f $top_srcdir/debian/tests/Makefile.regress PG_CONFIG=/usr/lib/postgresql/$MAJOR/bin/pg_config with_llvm=no
+
+# tell regression files that regress.so is not installed
+sed -i -e "s;set regresslib :libdir;set regresslib '$PWD';" sql/* expected/*
+
+# when root, execute testsuite as user postgres since it insists on wiping the tablespace directory
+if [ $(id -u) = 0 ]; then
+ SU="su postgres"
+else
+ SU="sh"
+fi
+
+$SU <<EOF
+set -eux
+
+# create tablespace and results directories
+OUTPUT=\$(mktemp -d /tmp/regress.XXXXXX)
+trap "rm -rf \$OUTPUT" EXIT
+
+# run the regression tests
+if ! pg_virtualenv -v $MAJOR \
+ /usr/lib/postgresql/$MAJOR/lib/pgxs/src/test/regress/pg_regress \
+ --schedule=parallel_schedule \
+ --outputdir=\$OUTPUT \
+ --temp-config=/usr/share/postgresql-common/server/test-with-jit.conf
+ then
+ head -100 \$OUTPUT/regression.diffs
+ exit 1
+fi
+EOF
diff --git a/debian/tests/run-testsuite b/debian/tests/run-testsuite
new file mode 100755
index 0000000..0ba6dc6
--- /dev/null
+++ b/debian/tests/run-testsuite
@@ -0,0 +1,5 @@
+#!/bin/sh
+set -e
+
+cd /usr/share/postgresql-common
+./testsuite -v 16
diff --git a/debian/watch b/debian/watch
new file mode 100644
index 0000000..93d34b3
--- /dev/null
+++ b/debian/watch
@@ -0,0 +1,4 @@
+version=3
+opts=uversionmangle=s/alpha/~alpha/;s/beta/~beta/;s/rc/~rc/ \
+https://ftp.postgresql.org/pub/source/v(16.*)/postgresql-(16.*).tar.bz2
+