git: 6f04d9b8607c - 2025Q2 - databases/postgresql??-*: Update to latest version

From: Palle Girgensohn <girgen_at_FreeBSD.org>
Date: Sat, 17 May 2025 11:19:32 UTC
The branch 2025Q2 has been updated by girgen:

URL: https://cgit.FreeBSD.org/ports/commit/?id=6f04d9b8607c00789098d47ff64334ce04608f70

commit 6f04d9b8607c00789098d47ff64334ce04608f70
Author:     Palle Girgensohn <girgen@FreeBSD.org>
AuthorDate: 2025-05-08 19:46:50 +0000
Commit:     Palle Girgensohn <girgen@FreeBSD.org>
CommitDate: 2025-05-17 11:19:19 +0000

    databases/postgresql??-*: Update to latest version
    
    PostgreSQL 17.5, 16.9, 15.13, 14.18, and 13.21 Released!
    
    The PostgreSQL Global Development Group has released an update to all
    supported versions of PostgreSQL, including 17.5, 16.9, 15.13, 14.18,
    and 13.21. This release fixes 1 security vulnerability and over 60 bugs
    reported over the last several months.
    
    Security:       78b8e808-2c45-11f0-9a65-6cc21735f730
    Release notes:  https://www.postgresql.org/about/news/postgresql-175-169-1513-1418-and-1321-released-3072/
    
    (cherry picked from commit a9608d62ae7125d78cd9f16748f786c8581699ad)
---
 Mk/Uses/pgsql.mk                                   |    2 +-
 databases/postgresql13-client/Makefile             |    2 +-
 databases/postgresql13-server/Makefile             |    4 +-
 databases/postgresql13-server/distinfo             |    6 +-
 databases/postgresql13-server/pkg-plist-client     |    1 +
 databases/postgresql13-server/pkg-plist-server     |    1 +
 databases/postgresql14-client/Makefile             |    2 +-
 databases/postgresql14-server/Makefile             |    4 +-
 databases/postgresql14-server/distinfo             |    6 +-
 databases/postgresql14-server/pkg-plist-client     |    1 +
 databases/postgresql14-server/pkg-plist-server     |    3 +-
 databases/postgresql15-client/Makefile             |    2 +-
 databases/postgresql15-server/Makefile             |    4 +-
 databases/postgresql15-server/distinfo             |    6 +-
 databases/postgresql15-server/pkg-plist-client     |    1 +
 databases/postgresql15-server/pkg-plist-server     |    1 +
 databases/postgresql16-client/Makefile             |    2 +-
 databases/postgresql16-server/Makefile             |    4 +-
 databases/postgresql16-server/distinfo             |    6 +-
 databases/postgresql16-server/pkg-plist-server     |    1 +
 databases/postgresql17-client/Makefile             |    2 +-
 databases/postgresql17-server/Makefile             |    4 +-
 databases/postgresql17-server/distinfo             |    6 +-
 databases/postgresql17-server/pkg-plist-server     |    1 +
 databases/postgresql18-client/Makefile             |   28 +
 databases/postgresql18-contrib/Makefile            |   41 +
 databases/postgresql18-contrib/pkg-descr           |   21 +
 databases/postgresql18-docs/Makefile               |   38 +
 databases/postgresql18-pgtcl/Makefile              |    9 +
 databases/postgresql18-plperl/Makefile             |   27 +
 databases/postgresql18-plpython/Makefile           |   29 +
 databases/postgresql18-plpython/pkg-descr          |    4 +
 databases/postgresql18-pltcl/Makefile              |   32 +
 databases/postgresql18-server/Makefile             |  245 +++
 databases/postgresql18-server/distinfo             |    3 +
 databases/postgresql18-server/files/502.pgsql.in   |  114 ++
 databases/postgresql18-server/files/dot.cshrc.in   |   11 +
 databases/postgresql18-server/files/dot.profile.in |   22 +
 .../files/patch-src-Makefile.shlib                 |   11 +
 .../files/patch-src-backend-Makefile               |   11 +
 ...h-src_backend_utils_misc_postgresql.conf.sample |   10 +
 .../files/pkg-message-client.in                    |   38 +
 .../files/pkg-message-contrib.in                   |    9 +
 .../files/pkg-message-plperl.in                    |    9 +
 .../files/pkg-message-plpython.in                  |    9 +
 .../postgresql18-server/files/pkg-message-pltcl.in |    9 +
 .../files/pkg-message-server.in                    |   70 +
 .../postgresql18-server/files/pkgIndex.tcl.in      |    4 +
 databases/postgresql18-server/files/postgresql.in  |  125 ++
 databases/postgresql18-server/pkg-descr            |   21 +
 databases/postgresql18-server/pkg-install-server   |   23 +
 databases/postgresql18-server/pkg-plist-client     | 1400 ++++++++++++++++
 databases/postgresql18-server/pkg-plist-contrib    |  281 ++++
 databases/postgresql18-server/pkg-plist-plperl     |   24 +
 databases/postgresql18-server/pkg-plist-plpython   |   32 +
 databases/postgresql18-server/pkg-plist-pltcl      |    6 +
 databases/postgresql18-server/pkg-plist-server     | 1725 ++++++++++++++++++++
 57 files changed, 4481 insertions(+), 32 deletions(-)

diff --git a/Mk/Uses/pgsql.mk b/Mk/Uses/pgsql.mk
index 20f43a5e17f2..0ce84d448e2c 100644
--- a/Mk/Uses/pgsql.mk
+++ b/Mk/Uses/pgsql.mk
@@ -39,7 +39,7 @@ _INCLUDE_USES_PGSQL_MK=	yes
 
 # When adding a version, please keep the comment in
 # Mk/bsd.default-versions.mk in sync.
-VALID_PGSQL_VER=	13 14 15 16 17
+VALID_PGSQL_VER=	13 14 15 16 17 18
 
 # Override non-default LIBVERS like this:
 #PGSQL99_LIBVER=6
diff --git a/databases/postgresql13-client/Makefile b/databases/postgresql13-client/Makefile
index 41c72b43198c..4d4849b56ebe 100644
--- a/databases/postgresql13-client/Makefile
+++ b/databases/postgresql13-client/Makefile
@@ -1,5 +1,5 @@
 PORTNAME=	postgresql
-PORTREVISION=	1
+PORTREVISION=	0
 
 COMMENT=	PostgreSQL database (client)
 
diff --git a/databases/postgresql13-server/Makefile b/databases/postgresql13-server/Makefile
index 87196779fe42..ae0b013f11c0 100644
--- a/databases/postgresql13-server/Makefile
+++ b/databases/postgresql13-server/Makefile
@@ -1,7 +1,7 @@
-DISTVERSION?=	13.20
+DISTVERSION?=	13.21
 # PORTREVISION must be ?= otherwise, all slave ports get this PORTREVISION and
 # not their own.  Probably best to keep it at ?=0 when reset here too.
-PORTREVISION?=	1
+PORTREVISION?=	0
 
 MAINTAINER?=	pgsql@FreeBSD.org
 
diff --git a/databases/postgresql13-server/distinfo b/databases/postgresql13-server/distinfo
index 723c2fb98f2f..d2ad227cd1bb 100644
--- a/databases/postgresql13-server/distinfo
+++ b/databases/postgresql13-server/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1739873705
-SHA256 (postgresql/postgresql-13.20.tar.bz2) = 8134b685724d15e60d93bea206fbe0f14c8295e84f1cc91d5a3928163e4fb288
-SIZE (postgresql/postgresql-13.20.tar.bz2) = 21730844
+TIMESTAMP = 1746521296
+SHA256 (postgresql/postgresql-13.21.tar.bz2) = dcda1294df45f033b0656cf7a8e4afbbc624c25e1b144aec79530f74d7ef4ab4
+SIZE (postgresql/postgresql-13.21.tar.bz2) = 21759813
diff --git a/databases/postgresql13-server/pkg-plist-client b/databases/postgresql13-server/pkg-plist-client
index df4b84846210..d4cd83b62c15 100644
--- a/databases/postgresql13-server/pkg-plist-client
+++ b/databases/postgresql13-server/pkg-plist-client
@@ -431,6 +431,7 @@ include/postgresql/server/libpq/be-gssapi-common.h
 include/postgresql/server/libpq/crypt.h
 include/postgresql/server/libpq/hba.h
 include/postgresql/server/libpq/ifaddr.h
+include/postgresql/server/libpq/libpq-be-fe-helpers.h
 include/postgresql/server/libpq/libpq-be.h
 include/postgresql/server/libpq/libpq-fs.h
 include/postgresql/server/libpq/libpq.h
diff --git a/databases/postgresql13-server/pkg-plist-server b/databases/postgresql13-server/pkg-plist-server
index f58235e4c4d2..d33aaa30b518 100644
--- a/databases/postgresql13-server/pkg-plist-server
+++ b/databases/postgresql13-server/pkg-plist-server
@@ -1008,6 +1008,7 @@ lib/postgresql/utf8_and_win.so
 %%TZDATA%%%%DATADIR%%/timezone/America/Coral_Harbour
 %%TZDATA%%%%DATADIR%%/timezone/America/Cordoba
 %%TZDATA%%%%DATADIR%%/timezone/America/Costa_Rica
+%%TZDATA%%%%DATADIR%%/timezone/America/Coyhaique
 %%TZDATA%%%%DATADIR%%/timezone/America/Creston
 %%TZDATA%%%%DATADIR%%/timezone/America/Cuiaba
 %%TZDATA%%%%DATADIR%%/timezone/America/Curacao
diff --git a/databases/postgresql14-client/Makefile b/databases/postgresql14-client/Makefile
index 6935b67ef80f..965e37834a6d 100644
--- a/databases/postgresql14-client/Makefile
+++ b/databases/postgresql14-client/Makefile
@@ -1,5 +1,5 @@
 PORTNAME=	postgresql
-PORTREVISION=	1
+PORTREVISION=	0
 
 COMMENT=	PostgreSQL database (client)
 
diff --git a/databases/postgresql14-server/Makefile b/databases/postgresql14-server/Makefile
index ebd219f4a32b..4fc3988300f0 100644
--- a/databases/postgresql14-server/Makefile
+++ b/databases/postgresql14-server/Makefile
@@ -1,7 +1,7 @@
-DISTVERSION?=	14.17
+DISTVERSION?=	14.18
 # PORTREVISION must be ?= otherwise, all slave ports get this PORTREVISION and
 # not their own.  Probably best to keep it at ?=0 when reset here too.
-PORTREVISION?=	1
+PORTREVISION?=	0
 
 MAINTAINER?=	pgsql@FreeBSD.org
 
diff --git a/databases/postgresql14-server/distinfo b/databases/postgresql14-server/distinfo
index 4612d80a9b14..886ee28e6b73 100644
--- a/databases/postgresql14-server/distinfo
+++ b/databases/postgresql14-server/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1739873706
-SHA256 (postgresql/postgresql-14.17.tar.bz2) = 6ce0ccd6403bf7f0f2eddd333e2ee9ba02edfa977c66660ed9b4b1057e7630a1
-SIZE (postgresql/postgresql-14.17.tar.bz2) = 22488812
+TIMESTAMP = 1746521297
+SHA256 (postgresql/postgresql-14.18.tar.bz2) = 83ab29d6bfc3dc58b2ed3c664114fdfbeb6a0450c4b8d7fa69aee91e3ca14f8e
+SIZE (postgresql/postgresql-14.18.tar.bz2) = 22503241
diff --git a/databases/postgresql14-server/pkg-plist-client b/databases/postgresql14-server/pkg-plist-client
index e74d85fe4dec..fbf21dfcec43 100644
--- a/databases/postgresql14-server/pkg-plist-client
+++ b/databases/postgresql14-server/pkg-plist-client
@@ -447,6 +447,7 @@ include/postgresql/server/libpq/be-gssapi-common.h
 include/postgresql/server/libpq/crypt.h
 include/postgresql/server/libpq/hba.h
 include/postgresql/server/libpq/ifaddr.h
+include/postgresql/server/libpq/libpq-be-fe-helpers.h
 include/postgresql/server/libpq/libpq-be.h
 include/postgresql/server/libpq/libpq-fs.h
 include/postgresql/server/libpq/libpq.h
diff --git a/databases/postgresql14-server/pkg-plist-server b/databases/postgresql14-server/pkg-plist-server
index 8f00f179a298..254729c73cdc 100644
--- a/databases/postgresql14-server/pkg-plist-server
+++ b/databases/postgresql14-server/pkg-plist-server
@@ -1008,7 +1008,6 @@ lib/postgresql/utf8_and_win.so
 %%TZDATA%%%%DATADIR%%/timezone/America/Bahia
 %%TZDATA%%%%DATADIR%%/timezone/America/Bahia_Banderas
 %%TZDATA%%%%DATADIR%%/timezone/America/Barbados
-%%TZDATA%%%%DATADIR%%/timezone/America/Ciudad_Juarez
 %%TZDATA%%%%DATADIR%%/timezone/America/Belem
 %%TZDATA%%%%DATADIR%%/timezone/America/Belize
 %%TZDATA%%%%DATADIR%%/timezone/America/Blanc-Sablon
@@ -1025,9 +1024,11 @@ lib/postgresql/utf8_and_win.so
 %%TZDATA%%%%DATADIR%%/timezone/America/Cayman
 %%TZDATA%%%%DATADIR%%/timezone/America/Chicago
 %%TZDATA%%%%DATADIR%%/timezone/America/Chihuahua
+%%TZDATA%%%%DATADIR%%/timezone/America/Ciudad_Juarez
 %%TZDATA%%%%DATADIR%%/timezone/America/Coral_Harbour
 %%TZDATA%%%%DATADIR%%/timezone/America/Cordoba
 %%TZDATA%%%%DATADIR%%/timezone/America/Costa_Rica
+%%TZDATA%%%%DATADIR%%/timezone/America/Coyhaique
 %%TZDATA%%%%DATADIR%%/timezone/America/Creston
 %%TZDATA%%%%DATADIR%%/timezone/America/Cuiaba
 %%TZDATA%%%%DATADIR%%/timezone/America/Curacao
diff --git a/databases/postgresql15-client/Makefile b/databases/postgresql15-client/Makefile
index e12ab2f37904..dc5fd4c3da8e 100644
--- a/databases/postgresql15-client/Makefile
+++ b/databases/postgresql15-client/Makefile
@@ -1,5 +1,5 @@
 PORTNAME=	postgresql
-PORTREVISION=	1
+PORTREVISION=	0
 
 COMMENT=	PostgreSQL database (client)
 
diff --git a/databases/postgresql15-server/Makefile b/databases/postgresql15-server/Makefile
index 959c02e355a5..09077a1fcb18 100644
--- a/databases/postgresql15-server/Makefile
+++ b/databases/postgresql15-server/Makefile
@@ -1,7 +1,7 @@
-DISTVERSION?=	15.12
+DISTVERSION?=	15.13
 # PORTREVISION must be ?= otherwise, all slave ports get this PORTREVISION and
 # not their own.  Probably best to keep it at ?=0 when reset here too.
-PORTREVISION?=	1
+PORTREVISION?=	0
 
 MAINTAINER?=	pgsql@FreeBSD.org
 
diff --git a/databases/postgresql15-server/distinfo b/databases/postgresql15-server/distinfo
index cd3b74a3a24e..960718cd0db9 100644
--- a/databases/postgresql15-server/distinfo
+++ b/databases/postgresql15-server/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1739873912
-SHA256 (postgresql/postgresql-15.12.tar.bz2) = 3bc8462a38ca0857270cc88b949a3f6659f0d5c44c029c482355835b61a0f6f7
-SIZE (postgresql/postgresql-15.12.tar.bz2) = 23170228
+TIMESTAMP = 1746521298
+SHA256 (postgresql/postgresql-15.13.tar.bz2) = 4f62e133d22ea08a0401b0840920e26698644d01a80c34341fb732dd0a90ca5d
+SIZE (postgresql/postgresql-15.13.tar.bz2) = 23190593
diff --git a/databases/postgresql15-server/pkg-plist-client b/databases/postgresql15-server/pkg-plist-client
index 93996c66c021..e85f09cf4db5 100644
--- a/databases/postgresql15-server/pkg-plist-client
+++ b/databases/postgresql15-server/pkg-plist-client
@@ -456,6 +456,7 @@ include/postgresql/server/libpq/auth.h
 include/postgresql/server/libpq/be-fsstubs.h
 include/postgresql/server/libpq/be-gssapi-common.h
 include/postgresql/server/libpq/crypt.h
+include/postgresql/server/libpq/libpq-be-fe-helpers.h
 include/postgresql/server/libpq/hba.h
 include/postgresql/server/libpq/ifaddr.h
 include/postgresql/server/libpq/libpq-be.h
diff --git a/databases/postgresql15-server/pkg-plist-server b/databases/postgresql15-server/pkg-plist-server
index cea77992a139..4ada93678b40 100644
--- a/databases/postgresql15-server/pkg-plist-server
+++ b/databases/postgresql15-server/pkg-plist-server
@@ -1079,6 +1079,7 @@ lib/postgresql/utf8_and_win.so
 %%TZDATA%%%%DATADIR%%/timezone/America/Coral_Harbour
 %%TZDATA%%%%DATADIR%%/timezone/America/Cordoba
 %%TZDATA%%%%DATADIR%%/timezone/America/Costa_Rica
+%%TZDATA%%%%DATADIR%%/timezone/America/Coyhaique
 %%TZDATA%%%%DATADIR%%/timezone/America/Creston
 %%TZDATA%%%%DATADIR%%/timezone/America/Cuiaba
 %%TZDATA%%%%DATADIR%%/timezone/America/Curacao
diff --git a/databases/postgresql16-client/Makefile b/databases/postgresql16-client/Makefile
index bbfa502bc076..7c4351eb7245 100644
--- a/databases/postgresql16-client/Makefile
+++ b/databases/postgresql16-client/Makefile
@@ -1,5 +1,5 @@
 PORTNAME=	postgresql
-PORTREVISION=	1
+PORTREVISION=	0
 
 COMMENT=	PostgreSQL database (client)
 
diff --git a/databases/postgresql16-server/Makefile b/databases/postgresql16-server/Makefile
index 4ad9ebbd9ab4..a2258f336743 100644
--- a/databases/postgresql16-server/Makefile
+++ b/databases/postgresql16-server/Makefile
@@ -1,8 +1,8 @@
 PORTNAME?=	postgresql
-DISTVERSION?=	16.8
+DISTVERSION?=	16.9
 # PORTREVISION must be ?= otherwise, all slave ports get this PORTREVISION and
 # not their own.  Probably best to keep it at ?=0 when reset here too.
-PORTREVISION?=	1
+PORTREVISION?=	0
 CATEGORIES?=	databases
 MASTER_SITES=	PGSQL/source/v${DISTVERSION}
 PKGNAMESUFFIX?= ${PORTVERSION:R}${COMPONENT}
diff --git a/databases/postgresql16-server/distinfo b/databases/postgresql16-server/distinfo
index 3bccde2d6243..802a569e97b5 100644
--- a/databases/postgresql16-server/distinfo
+++ b/databases/postgresql16-server/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1739873709
-SHA256 (postgresql/postgresql-16.8.tar.bz2) = 9468083a56ce0ee7d294601b74dad3dd9fc69d87aff61f0a9fb63c813ff7efd8
-SIZE (postgresql/postgresql-16.8.tar.bz2) = 24911337
+TIMESTAMP = 1746521299
+SHA256 (postgresql/postgresql-16.9.tar.bz2) = 07c00fb824df0a0c295f249f44691b86e3266753b380c96f633c3311e10bd005
+SIZE (postgresql/postgresql-16.9.tar.bz2) = 24936316
diff --git a/databases/postgresql16-server/pkg-plist-server b/databases/postgresql16-server/pkg-plist-server
index 898700cf027f..5b0e19ba98aa 100644
--- a/databases/postgresql16-server/pkg-plist-server
+++ b/databases/postgresql16-server/pkg-plist-server
@@ -1151,6 +1151,7 @@ lib/postgresql/utf8_and_win.so
 %%TZDATA%%%%DATADIR%%/timezone/America/Coral_Harbour
 %%TZDATA%%%%DATADIR%%/timezone/America/Cordoba
 %%TZDATA%%%%DATADIR%%/timezone/America/Costa_Rica
+%%TZDATA%%%%DATADIR%%/timezone/America/Coyhaique
 %%TZDATA%%%%DATADIR%%/timezone/America/Creston
 %%TZDATA%%%%DATADIR%%/timezone/America/Cuiaba
 %%TZDATA%%%%DATADIR%%/timezone/America/Curacao
diff --git a/databases/postgresql17-client/Makefile b/databases/postgresql17-client/Makefile
index 1d1b9592277a..b59824808a9d 100644
--- a/databases/postgresql17-client/Makefile
+++ b/databases/postgresql17-client/Makefile
@@ -1,5 +1,5 @@
 PORTNAME=	postgresql
-PORTREVISION=	1
+PORTREVISION=	0
 
 COMMENT=	PostgreSQL database (client)
 
diff --git a/databases/postgresql17-server/Makefile b/databases/postgresql17-server/Makefile
index d5d68a3fe154..9ffd292e7e70 100644
--- a/databases/postgresql17-server/Makefile
+++ b/databases/postgresql17-server/Makefile
@@ -1,8 +1,8 @@
 PORTNAME?=	postgresql
-DISTVERSION?=	17.4
+DISTVERSION?=	17.5
 # PORTREVISION must be ?= otherwise, all slave ports get this PORTREVISION and
 # not their own.  Probably best to keep it at ?=0 when reset here too.
-PORTREVISION?=	1
+PORTREVISION?=	0
 CATEGORIES?=	databases
 MASTER_SITES=	PGSQL/source/v${DISTVERSION}
 #DISTFILES+=	${PORTNAME}-${DISTVERSION}-docs.tar.bz:docs
diff --git a/databases/postgresql17-server/distinfo b/databases/postgresql17-server/distinfo
index 24f0a6d70703..ab999c575a5f 100644
--- a/databases/postgresql17-server/distinfo
+++ b/databases/postgresql17-server/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1739873710
-SHA256 (postgresql/postgresql-17.4.tar.bz2) = c4605b73fea11963406699f949b966e5d173a7ee0ccaef8938dec0ca8a995fe7
-SIZE (postgresql/postgresql-17.4.tar.bz2) = 21519810
+TIMESTAMP = 1746521300
+SHA256 (postgresql/postgresql-17.5.tar.bz2) = fcb7ab38e23b264d1902cb25e6adafb4525a6ebcbd015434aeef9eda80f528d8
+SIZE (postgresql/postgresql-17.5.tar.bz2) = 21595174
diff --git a/databases/postgresql17-server/pkg-plist-server b/databases/postgresql17-server/pkg-plist-server
index d1f2d2383d85..0ee593624118 100644
--- a/databases/postgresql17-server/pkg-plist-server
+++ b/databases/postgresql17-server/pkg-plist-server
@@ -1160,6 +1160,7 @@ lib/postgresql/utf8_and_win.so
 %%TZDATA%%%%DATADIR%%/timezone/America/Coral_Harbour
 %%TZDATA%%%%DATADIR%%/timezone/America/Cordoba
 %%TZDATA%%%%DATADIR%%/timezone/America/Costa_Rica
+%%TZDATA%%%%DATADIR%%/timezone/America/Coyhaique
 %%TZDATA%%%%DATADIR%%/timezone/America/Creston
 %%TZDATA%%%%DATADIR%%/timezone/America/Cuiaba
 %%TZDATA%%%%DATADIR%%/timezone/America/Curacao
diff --git a/databases/postgresql18-client/Makefile b/databases/postgresql18-client/Makefile
new file mode 100644
index 000000000000..45f2e410f4c3
--- /dev/null
+++ b/databases/postgresql18-client/Makefile
@@ -0,0 +1,28 @@
+PORTNAME=	postgresql
+PORTREVISION=	0
+
+COMMENT=	PostgreSQL database (client)
+
+MASTERDIR=	${.CURDIR}/../postgresql18-server
+
+BUILD_DIRS=	config src/include src/interfaces src/port src/bin/pg_amcheck \
+		src/bin/pg_dump src/bin/psql src/bin/scripts src/bin/pg_config \
+		src/bin/pgbench src/makefiles src/test/regress
+INSTALL_DIRS=	${BUILD_DIRS}
+
+CLIENT_ONLY=	yes
+COMPONENT=	-client
+USE_LDCONFIG=	yes
+USES=		pkgconfig
+
+OPTIONS_DEFINE+=LIBEDIT DOCS
+LIBEDIT_DESC=	Use non-GPL libedit instead of readline
+LIBEDIT_CONFIGURE_ON+=--with-libedit-preferred
+LIBEDIT_USES=	libedit
+LIBEDIT_USES_OFF=readline
+BUILD_DEPENDS+=	docbook-xml>0:textproc/docbook-xml \
+		docbook-xsl>=0:textproc/docbook-xsl \
+		xmllint:textproc/libxml2 \
+		xsltproc:textproc/libxslt
+
+.include "${MASTERDIR}/Makefile"
diff --git a/databases/postgresql18-contrib/Makefile b/databases/postgresql18-contrib/Makefile
new file mode 100644
index 000000000000..9a73e8733994
--- /dev/null
+++ b/databases/postgresql18-contrib/Makefile
@@ -0,0 +1,41 @@
+PORTNAME=	postgresql
+PORTREVISION=	0
+CATEGORIES=	databases
+
+MAINTAINER=	pgsql@FreeBSD.org
+COMMENT=	The contrib utilities from the PostgreSQL distribution
+
+MASTERDIR=	${.CURDIR}/../postgresql18-server
+
+USES=		bison pgsql:${PORTVERSION:R}
+
+BUILD_DIRS=	src/port src/include src/common contrib
+INSTALL_DIRS=	contrib
+
+# this port fails to build in parallel
+MAKE_JOBS_UNSAFE=	yes
+
+SLAVE_ONLY=	yes
+COMPONENT=	-contrib
+CONFIGURE_ARGS=	--disable-nls --with-uuid=bsd
+LDFLAGS+=	-lpthread -L${PREFIX}/lib
+
+OPTIONS_DEFINE=	DOCS OPENSSL XML
+OPTIONS_DEFAULT=OPENSSL XML
+OPTIONS_SUB=	yes
+
+OPENSSL_DESC=		Build with OpenSSL support
+OPENSSL_USES=		ssl
+OPENSSL_CONFIGURE_WITH=	openssl
+
+XML_CONFIGURE_WITH=	libxslt libxml
+XML_LIB_DEPENDS=libxslt.so:textproc/libxslt \
+		libxml2.so:textproc/libxml2
+
+post-configure:
+	@cd ${WRKSRC}/src/backend && ${SETENVI} ${WRK_ENV} ${MAKE_ENV} ${MAKE_CMD} generated-headers
+
+post-install:
+	@- ${INSTALL_DATA} ${WRKSRC}/contrib/README ${STAGEDIR}${DOCSDIR}/extension/README
+
+.include "${MASTERDIR}/Makefile"
diff --git a/databases/postgresql18-contrib/pkg-descr b/databases/postgresql18-contrib/pkg-descr
new file mode 100644
index 000000000000..a384c76fdbde
--- /dev/null
+++ b/databases/postgresql18-contrib/pkg-descr
@@ -0,0 +1,21 @@
+This is the port for all stuff that comes in the contrib subtree of
+the postgresql distribution. This subtree contains porting tools,
+analysis utilities, and plug-in features that are not part of the core
+PostgreSQL system, mainly because they address a limited audience or
+are too experimental to be part of the main source tree.  This does
+not preclude their usefulness.
+
+Each subdirectory contains a README file with information about the
+module. Some directories supply new user-defined functions, operators,
+or types.  After you have installed the files you need to register the
+new entities in the database system by running the commands in the
+supplied .sql file.  For example,
+
+        $ psql -d dbname -f module.sql
+
+The .sql files are installed into /usr/local/share/postgresql/contrib
+
+For more information, please see
+/usr/local/share/doc/postgresql/contrib/README*
+
+This software is part of the standard PostgreSQL distribution.
diff --git a/databases/postgresql18-docs/Makefile b/databases/postgresql18-docs/Makefile
new file mode 100644
index 000000000000..81c1ac65c5d7
--- /dev/null
+++ b/databases/postgresql18-docs/Makefile
@@ -0,0 +1,38 @@
+PORTNAME=	postgresql
+PORTREVISION=	0
+PKGNAMESUFFIX?=	${WANT_PGSQL_VER:S,.,,}-docs
+
+MAINTAINER=	pgsql@FreeBSD.org
+COMMENT=	The PostgreSQL documentation set
+
+MASTERDIR=	${.CURDIR}/../../databases/postgresql${WANT_PGSQL_VER}-server
+WANT_PGSQL_VER?=18
+
+DISTV=		${DISTVERSION:R}
+
+SLAVE_ONLY=	YES
+COMPONENT=	-docs
+
+PGDOCSREL?=	${DOCSDIR_REL}/release-${WANT_PGSQL_VER}
+PGDOCSDIR?=	${PREFIX}/${PGDOCSREL}
+
+BUILD_DEPENDS+=	docbook-xml>0:textproc/docbook-xml \
+		docbook-xsl>=0:textproc/docbook-xsl \
+		xmllint:textproc/libxml2 \
+		xsltproc:textproc/libxslt
+
+CONFIGURE_ARGS=	--without-readline --without-icu
+NO_ARCH=	yes
+
+do-build:
+	${MAKE_CMD} -C ${WRKSRC} html
+
+do-install:
+	@ ${MKDIR} ${STAGEDIR}${PGDOCSDIR}
+	( cd ${WRKSRC}/doc/src/sgml/html && \
+		${COPYTREE_SHARE} . ${STAGEDIR}${PGDOCSDIR} )
+
+post-install:
+	@(cd ${STAGEDIR}${PREFIX} && ${FIND} ${PGDOCSREL} -type f) >> ${TMPPLIST}
+
+.include "${MASTERDIR}/Makefile"
diff --git a/databases/postgresql18-pgtcl/Makefile b/databases/postgresql18-pgtcl/Makefile
new file mode 100644
index 000000000000..aebc4a84e0b0
--- /dev/null
+++ b/databases/postgresql18-pgtcl/Makefile
@@ -0,0 +1,9 @@
+PORTREVISION=	0
+PKGNAMESUFFIX=	-postgresql18
+
+CONFLICTS=	pgtcl pgtcl-postgresql1[012345689]
+
+PGTCL_SLAVE=	18
+MASTERDIR=	${.CURDIR}/../pgtcl
+
+.include "${MASTERDIR}/Makefile"
diff --git a/databases/postgresql18-plperl/Makefile b/databases/postgresql18-plperl/Makefile
new file mode 100644
index 000000000000..560a63c9da09
--- /dev/null
+++ b/databases/postgresql18-plperl/Makefile
@@ -0,0 +1,27 @@
+PORTNAME=	postgresql
+# Keep the ?=, this port is used as master by the other plperl.
+PORTREVISION?=	0
+CATEGORIES=	databases perl5
+PKGNAMESUFFIX?=	${WANT_PGSQL_VER}${COMPONENT}
+
+MAINTAINER=	pgsql@FreeBSD.org
+COMMENT=	Write SQL functions for PostgreSQL using Perl5
+
+RUN_DEPENDS=	postgres:databases/postgresql${WANT_PGSQL_VER}-server
+
+MASTERDIR=	${.CURDIR}/../../databases/postgresql${WANT_PGSQL_VER}-server
+
+WANT_PGSQL_VER?=18
+
+USES+=		perl5 readline
+CONFIGURE_ARGS=	--with-perl
+
+BUILD_DIRS=	src/backend ${INSTALL_DIRS}
+INSTALL_DIRS?=	src/pl/plperl contrib/bool_plperl contrib/hstore_plperl contrib/jsonb_plperl
+SLAVE_ONLY=	yes
+COMPONENT=	-plperl
+
+# this port fails to build in parallel
+MAKE_JOBS_UNSAFE=	yes
+
+.include "${MASTERDIR}/Makefile"
diff --git a/databases/postgresql18-plpython/Makefile b/databases/postgresql18-plpython/Makefile
new file mode 100644
index 000000000000..435c54cdbc2e
--- /dev/null
+++ b/databases/postgresql18-plpython/Makefile
@@ -0,0 +1,29 @@
+PORTNAME=	postgresql
+CATEGORIES=	databases python
+# Keep the ?=, it is used as master by the other plpython ports.
+PORTREVISION?=	0
+PKGNAMESUFFIX?=	${WANT_PGSQL_VER}${COMPONENT}
+
+MAINTAINER=	pgsql@FreeBSD.org
+COMMENT=	Module for using Python to write SQL functions
+WWW=		https://www.postgresql.org/
+
+USES+=		pgsql:${WANT_PGSQL_VER} ${WANT_PYTHON_USE}
+WANT_PGSQL=	server
+
+MASTERDIR=	${.CURDIR}/../postgresql${WANT_PGSQL_VER}-server
+
+WANT_PGSQL_VER?=	18
+WANT_PYTHON_USE?=	python
+
+CONFIGURE_ARGS=	--with-python
+COMPONENT=	-plpython
+
+BUILD_DIRS=	src/backend ${INSTALL_DIRS}
+INSTALL_DIRS?=	src/pl/plpython contrib/hstore_plpython contrib/jsonb_plpython contrib/ltree_plpython
+SLAVE_ONLY=	yes
+
+# this port fails to build in parallel
+MAKE_JOBS_UNSAFE=	yes
+
+.include "${MASTERDIR}/Makefile"
diff --git a/databases/postgresql18-plpython/pkg-descr b/databases/postgresql18-plpython/pkg-descr
new file mode 100644
index 000000000000..61c4875985f7
--- /dev/null
+++ b/databases/postgresql18-plpython/pkg-descr
@@ -0,0 +1,4 @@
+PL/Python allows one to write PostgeSQL stored functions and
+procedures in Python (http://www.python.org/).
+
+This software is part of the standard PostgreSQL distribution.
diff --git a/databases/postgresql18-pltcl/Makefile b/databases/postgresql18-pltcl/Makefile
new file mode 100644
index 000000000000..3510c70c4ec6
--- /dev/null
+++ b/databases/postgresql18-pltcl/Makefile
@@ -0,0 +1,32 @@
+PORTNAME=	postgresql
+# Keep the ?=, it is used by the other pltcl ports.
+PORTREVISION?=	0
+CATEGORIES=	databases tcl
+PKGNAMESUFFIX?=	${WANT_PGSQL_VER}${COMPONENT}
+
+MAINTAINER=	pgsql@FreeBSD.org
+COMMENT=	Module for using Tcl to write SQL functions
+
+MASTERDIR=	${.CURDIR}/../../databases/postgresql${WANT_PGSQL_VER}-server
+
+WANT_PGSQL_VER?=18
+
+USES+=		tcl pgsql:${WANT_PGSQL_VER}
+WANT_PGSQL=	server
+
+CONFIGURE_ARGS=	--with-tcl --without-tk \
+		--with-tclconfig="${TCL_LIBDIR}" \
+		--with-includes="${TCL_INCLUDEDIR}"
+
+CONFIGURE_ENV+=	TCLSH="${TCLSH}"
+MAKE_ENV+=	TCL_INCDIR="${TCL_INCLUDEDIR}"
+
+BUILD_DIRS=	src/backend src/pl/tcl
+INSTALL_DIRS=	src/pl/tcl
+SLAVE_ONLY=	yes
+COMPONENT=	-pltcl
+
+# this port fails to build in parallel
+MAKE_JOBS_UNSAFE=	yes
+
+.include "${MASTERDIR}/Makefile"
diff --git a/databases/postgresql18-server/Makefile b/databases/postgresql18-server/Makefile
new file mode 100644
index 000000000000..9d74945bec23
--- /dev/null
+++ b/databases/postgresql18-server/Makefile
@@ -0,0 +1,245 @@
+PORTNAME?=	postgresql
+DISTVERSION?=	18beta1
+# PORTREVISION must be ?= otherwise, all slave ports get this PORTREVISION and
+# not their own.  Probably best to keep it at ?=0 when reset here too.
+PORTREVISION?=	0
+CATEGORIES?=	databases
+MASTER_SITES=	PGSQL/source/v${DISTVERSION}
+#DISTFILES+=	${PORTNAME}-${DISTVERSION}-docs.tar.bz:docs
+PKGNAMESUFFIX?= ${PORTVERSION:R}${COMPONENT}
+
+MAINTAINER?=	pgsql@FreeBSD.org
+COMMENT?=	PostgreSQL is the most advanced open-source database available anywhere
+WWW=		https://www.postgresql.org/
+
+LICENSE=	PostgreSQL
+
+CONFLICTS+=	${PORTNAME}1[^${PORTVERSION:R:C/.*([0-9]$)/\\1/}]*
+
+WRKSRC=		${WRKDIR}/postgresql-${DISTVERSION}
+DIST_SUBDIR=	postgresql
+
+OPTIONS_SUB=	yes
+
+PKGINSTALL?=	${PKGDIR}/pkg-install${COMPONENT}
+USES+=		bison perl5 tar:bzip2 cpe
+USE_PERL5=	build
+.if !defined(NO_BUILD)
+USES+=		gmake
+GNU_CONFIGURE=	yes
+GNU_CONFIGURE_MANPREFIX=${PREFIX}/share
+.endif
+
+PG_USER?=	postgres
+PG_GROUP?=	postgres
+PG_UID?=	770
+
+LDFLAGS+=	-L${LOCALBASE}/lib
+INCLUDES+=	-I${LOCALBASE}/include
+CONFIGURE_ARGS+=--with-libraries=${PREFIX}/lib \
+		--with-includes=${PREFIX}/include \
+		--enable-thread-safety
+CONFIGURE_ENV+=	INCLUDES="${INCLUDES}" \
+		PTHREAD_LIBS="-lpthread" \
+		LDFLAGS_SL="${LDFLAGS_SL}"
+LDFLAGS+=	-lpthread
+MAKE_ENV=	MAKELEVEL=0
+
+PLIST=		${PKGDIR}/pkg-plist${COMPONENT}
+
+INSTALL_DIRS?=	src/common src/timezone src/backend \
+		src/backend/utils/mb/conversion_procs \
+		src/backend/snowball src/backend/replication/libpqwalreceiver \
+		src/backend/replication/pgoutput \
+		src/bin/initdb src/bin/pg_ctl \
+		src/bin/pg_archivecleanup src/bin/pg_basebackup \
+		src/bin/pg_checksums \
+		src/bin/pg_controldata src/bin/pg_resetwal src/pl \
+		src/bin/pg_rewind \
+		src/bin/pg_test_fsync src/bin/pg_test_timing \
+		src/bin/pg_waldump src/bin/pg_upgrade
+
+BUILD_DIRS?=	src/port ${INSTALL_DIRS}
+INSTALL_TARGET?=install-strip
+
+.if !defined(CLIENT_ONLY) && !defined(SLAVE_ONLY)
+SERVER_ONLY=	yes
+COMPONENT=	-server
+USE_RC_SUBR=	postgresql
+USES+=		pgsql:${DISTVERSION:C/([0-9]\.?[0-9]).*/\1/g}
+USERS=		${PG_USER}
+GROUPS=	${PG_GROUP}
+SUB_FILES+=	502.pgsql
+.endif
+
+MAKE_ENV+=	PATH=${PREFIX}/bin:${PATH}
+CONFIGURE_ENV+=	PATH=${PREFIX}/bin:${PATH}
+
+.if defined(SERVER_ONLY)
+OPTIONS_DEFINE=	DTRACE LDAP TZDATA XML DOCS
+OPTIONS_DEFAULT+=XML
+LDAP_DESC=	Build with LDAP authentication support
+TZDATA_DESC=	Use internal timezone database
+XML_DESC=	Build with XML data type
+
+DTRACE_CONFIGURE_ENABLE=dtrace
+DTRACE_LDFLAGS=		-lelf
+DTRACE_INSTALL_TARGET=	install
+
+.  if ${DISTVERSION:C/([0-9][0-9]).*/\1/g} >= 14
+OPTIONS_DEFINE+=	LZ4
+OPTIONS_DEFAULT+=	LZ4
+LZ4_DESC=		Build with LZ4 compression support
+LZ4_CONFIGURE_WITH=	lz4
+LZ4_LIB_DEPENDS+=	liblz4.so:archivers/liblz4
+.  endif
+
+.  if ${DISTVERSION:C/([0-9][0-9]).*/\1/g} >= 15
+OPTIONS_DEFINE+=	ZSTD
+OPTIONS_DEFAULT+=	ZSTD
+ZSTD_DESC=		Build with ZSTD compression support
+ZSTD_CONFIGURE_WITH=	zstd
+ZSTD_LIB_DEPENDS+=	libzstd.so:archivers/zstd
+.  endif
+
+OPTIONS_DEFINE+=	LLVM
+OPTIONS_DEFAULT+=	LLVM
+LLVM_DESC=		Build with support for JIT-compiling expressions
+LLVM_CONFIGURE_WITH=	llvm
+LLVM_CONFIGURE_ENV=	LLVM_CONFIG=${LLVM_CONFIG} \
+			CLANG=${LOCALBASE}/bin/clang${LLVM_VERSION}
+LLVM_USES=		llvm:min=11,lib
+
+CONFIGURE_ARGS+=	--with-icu
+LIB_DEPENDS+=		libicudata.so:devel/icu
+USES+=			pkgconfig
+.else
+CONFIGURE_ARGS+=	--without-icu
+.endif
+
+
+.if !defined(SLAVE_ONLY)
+OPTIONS_DEFINE+=	NLS PAM GSSAPI OPTIMIZED_CFLAGS DEBUG DOCS SSL
+NLS_DESC=		Use internationalized messages
+PAM_DESC=		Build with PAM Support
+GSSAPI_DESC=		Build with GSSAPI from base (security/krb5)
+OPTIMIZED_CFLAGS_DESC=	Builds with compiler optimizations (-O3)
+SSL_DESC=		Build with OpenSSL support
+
+OPTIONS_DEFAULT+=	SSL
+
+GSSAPI_USES=		gssapi:mit
+GSSAPI_CONFIGURE_WITH=	gssapi
+
+PATCH_DIST_STRIP=-p1
+.endif # !SLAVE_ONLY
+
+SSL_USES=		ssl
+SSL_CONFIGURE_WITH=	openssl
+
+PAM_CONFIGURE_WITH=	pam
+
+XML_CONFIGURE_WITH=	libxml
+XML_LIB_DEPENDS=	libxml2.so:textproc/libxml2
+
+TZDATA_CONFIGURE_OFF=	--with-system-tzdata=/usr/share/zoneinfo
+
+NLS_CONFIGURE_ENABLE=	nls
+NLS_USES=		gettext
+
+LDAP_CONFIGURE_WITH=	ldap
+LDAP_USES=		ldap
+
+OPTIMIZED_CFLAGS_CFLAGS=-O3 -funroll-loops
+
+DEBUG_CONFIGURE_ENABLE=	debug
+
+PLIST_SUB+=		PG_VERSION=${PORTVERSION:R} \
+			PG_USER=${PG_USER} \
+			PG_USER_regex=[[:<:]]${PG_USER}[[:>:]] \
+			PG_GROUP=${PG_GROUP} \
+			PG_GROUP_regex=[[:<:]]${PG_GROUP}[[:>:]]
+SUB_LIST+=		PG_VERSION=${PORTVERSION:R} \
+			PG_GROUP=${PG_GROUP} \
+			PG_USER=${PG_USER} \
+			PG_UID=${PG_UID}
+
+.include <bsd.port.options.mk>
+
+# i386 older than Pentium lacks SSE2 so the binary will not run if we build with clang -msse2
+# For such ancient CPUs, gcc must be used to build PostgreSQL.
+# https://www.postgresql.org/message-id/20190307140421.GA8362%40gate.oper.dinoex.org
+.if ${ARCH} == "i386"
+CFLAGS+=	-msse2
+.endif
+
+# For testing files in FILESDIR
+.include <bsd.port.pre.mk>
+
+.if ${PORT_OPTIONS:MLLVM}
+INSTALL_DIRS+=		src/backend/jit/llvm
+.endif
+
+.if defined(SERVER_ONLY)
+pre-build:
+	@${SH} ${PKGINSTALL} ${PORTNAME} PRE-INSTALL
+.endif
+
+.if !defined(NO_BUILD) && !target(do-build)
+
+do-build:
+	@ cd ${WRKSRC}/src/backend && ${SETENVI} ${WRK_ENV} ${MAKE_ENV} ${MAKE_CMD} generated-headers
+	@ for dir in ${BUILD_DIRS}; do \
+		cd ${WRKSRC}/$${dir} && ${SETENVI} ${WRK_ENV} ${MAKE_ENV} ${MAKE_CMD} ; \
+	done
+.  if defined(CLIENT_ONLY)
+	@ cd ${WRKSRC}/doc && ${SETENVI} ${WRK_ENV} ${MAKE_ENV} ${MAKE_CMD} man
+.  endif
+.  if exists(${FILESDIR}/pkg-message${COMPONENT}.in)
+SUB_FILES+=	pkg-message${COMPONENT}
+PKGMESSAGE=	${WRKSRC}/pkg-message${COMPONENT}
+.  endif
+.  if exists(${FILESDIR}/pkg-install${COMPONENT}.in)
+SUB_FILES+=	pkg-install${COMPONENT}
+.  endif
+
+post-patch:
+.  if defined(CLIENT_ONLY) && !defined(OPENSSL_PORT)
+	@${REINPLACE_CMD} \
+		-e '/^PKG_CONFIG_REQUIRES_PRIVATE = libssl libcrypto/d' \
+		${WRKSRC}/src/interfaces/libpq/Makefile
+.  endif
+
+do-install:
+	@for dir in ${INSTALL_DIRS}; do \
+	    cd ${WRKSRC}/$${dir} && \
+		${SETENVI} ${WRK_ENV} ${MAKE_ENV} ${MAKE_CMD} ${MAKE_ARGS} ${INSTALL_TARGET}; \
+	done
+.  if defined(SERVER_ONLY)
+	@ ${MKDIR} ${STAGEDIR}${PREFIX}/share/postgresql ;\
+	${MKDIR} ${STAGEDIR}${PREFIX}/etc/periodic/daily ;\
+	${INSTALL_SCRIPT} ${WRKDIR}/502.pgsql \
+			${STAGEDIR}${PREFIX}/etc/periodic/daily
+.  endif # SERVER_ONLY
+.  if defined(CLIENT_ONLY)
+	@ cd ${WRKSRC}/src && ${SETENVI} ${WRK_ENV} ${MAKE_ENV} ${MAKE_CMD} ${MAKE_ARGS} install-local
+	@ cd ${WRKSRC}/doc/src/sgml && ${COPYTREE_SHARE} "man1 man3 man7" ${STAGEDIR}${PREFIX}/share/man
+.  endif
+	@ if [ -r ${PKGMESSAGE} ]; then \
+		${MKDIR} ${STAGEDIR}${DOCSDIR} ;\
+		${INSTALL_DATA} ${PKGMESSAGE} ${STAGEDIR}${DOCSDIR}/README${COMPONENT} ;\
+	fi
+.endif # !NO_BUILD
+
+.if defined(SERVER_ONLY)
+check:
+	@if [ `id -u` != 0 ] ; then \
+	  ${ECHO} "Running postgresql regressions tests" ;\
+	  cd ${WRKSRC}; ${MAKE_CMD} check ;\
+	 else \
+	  ${ECHO} "You cannot run regression tests when postgresql is built as user root." ; \
+	  ${ECHO} "Clean and rebuild the port as a regular user to run the tests." ;\
+	 fi
+.endif
+
+.include <bsd.port.post.mk>
diff --git a/databases/postgresql18-server/distinfo b/databases/postgresql18-server/distinfo
new file mode 100644
index 000000000000..206d40ead1da
--- /dev/null
+++ b/databases/postgresql18-server/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1746521321
+SHA256 (postgresql/postgresql-18beta1.tar.bz2) = 0b7c83df6195398aa67dbf5c002e7fa4082be393aae99aa69926d483f98eb885
+SIZE (postgresql/postgresql-18beta1.tar.bz2) = 22248570
diff --git a/databases/postgresql18-server/files/502.pgsql.in b/databases/postgresql18-server/files/502.pgsql.in
new file mode 100644
index 000000000000..604ad3dadab8
--- /dev/null
+++ b/databases/postgresql18-server/files/502.pgsql.in
@@ -0,0 +1,114 @@
+#!/bin/sh
+#
+# Maintenance shell script to vacuum and backup database
+# Put this in /usr/local/etc/periodic/daily, and it will be run
+# every night
+#
+# Written by Palle Girgensohn <girgen@pingpong.net>
+#
+# In public domain, do what you like with it,
+# and use it at your own risk... :)
+#
+
+# Define these variables in either /etc/periodic.conf or
+# /etc/periodic.conf.local to override the default values.
+#
+# daily_pgsql_backup_enable="YES" # do backup of all databases
+# daily_pgsql_backup_enable="foo bar db1 db2" # only do backup of a limited selection of databases
+# daily_pgsql_vacuum_enable="YES" # do vacuum
+
+# If there is a global system configuration file, suck it in.
+#
+if [ -r /etc/defaults/periodic.conf ]
+then
+    . /etc/defaults/periodic.conf
+    source_periodic_confs
+fi
+
+: ${daily_pgsql_user:="%%PG_USER%%"}
+: ${daily_pgsql_port:=5432}
+: ${daily_pgsql_vacuum_args:="-U ${daily_pgsql_user} -p ${daily_pgsql_port} -qaz"}
+: ${daily_pgsql_pgdump_args:="-U ${daily_pgsql_user} -p ${daily_pgsql_port} -bF c"}
+: ${daily_pgsql_pgdumpall_globals_args:="-U ${daily_pgsql_user} -p ${daily_pgsql_port}"}
+# backupdir is relative to ~pgsql home directory unless it begins with a slash:
+: ${daily_pgsql_backupdir:="~${daily_pgsql_user}/backups"}
+: ${daily_pgsql_savedays:="7"}
+
+# allow '~' in directory name
+eval backupdir=${daily_pgsql_backupdir}
+
+rc=0
+
+pgsql_backup() {
+	# daily_pgsql_backupdir must be writeable by user %%PG_USER%%
+	# ~%%PG_USER%% is just that under normal circumstances,
+	# but this might not be where you want the backups...
+	if [ ! -d ${backupdir} ] ; then
+	    echo Creating ${backupdir}
+	    mkdir -m 700 ${backupdir}; chown ${daily_pgsql_user} ${backupdir}
+	fi
+
+	echo
*** 4039 LINES SKIPPED ***