Before you can run postgresql you'll need to create the
database files in /var/lib/pgsql. The following should do
the trick.
	# su postgres -c "initdb -D /var/lib/pgsql/18/data --locale=en_US.UTF-8 -A scram-sha-256 -W"

Additionally, a logrotation script and init script are included.
For production level log file handling please read
https://www.postgresql.org/docs/18/logfile-maintenance.html

In order to start postgresql at boot and stop it properly at shutdown,
make sure rc.postgresql18 is executable and add the following lines to
the following files:

	/etc/rc.d/rc.local
	==================
	# Startup postgresql
	if [ -x /etc/rc.d/rc.postgresql18 ]; then
		/etc/rc.d/rc.postgresql18 start
	fi

	/etc/rc.d/rc.local_shutdown
	===========================
	# Stop postgres
	if [ -x /etc/rc.d/rc.postgresql18 ]; then
		/etc/rc.d/rc.postgresql18 stop
	fi

Additionally, rc.postgresql18 script has additional modes for stop/restart:
  force-stop|force-restart (i.e. pg_ctl 'fast' mode)
  unclean-stop|unclean-restart (i.e. pg_ctl 'immediate' mode)
See https://www.postgresql.org/docs/18/app-pg-ctl.html

From PostgreSQL 9.3 we support in place database upgrades using pg_upgrade:
  https://www.postgresql.org/docs/18/pgupgrade.html

NOTE About Upgrading 
Databases initialized with PostgreSQL 18 initdb now have page checksums enabled by default.
This can affect upgrades from non-checksum enabled clusters,
which would require you to create a new PostgreSQL 18 cluster with the
--no-data-checksums option when using pg_upgrade.

A few hints for PostgreSQL 17.x -> 18.x upgrade:
  - Don't remove old PostgreSQL 17.x package (yet)
  - Install PostgreSQL 18.x, note that binaries are in
    '/usr/lib64/postgresql18/18/bin'
  - Create database file for postgresql 18 without data checksums
    # su postgres -c "initdb -D /var/lib/pgsql/18/data --no-data-checksums --locale=en_US.UTF-8 -A scram-sha-256 -W"
  - Adjust the pg_hba.conf in postgresql 18 to allow postgres user to connect
  - Run pg_upgrade (as postgres user)
	$ pg_upgrade --old-datadir /var/lib/pgsql/17/data/ --new-datadir /var/lib/pgsql/18/data/ --old-bindir /usr/lib64/postgresql17/17/bin/ --new-bindir /usr/lib64/postgresql18/18/bin/ -U postgres
  - Start postgresql 18 service
  - Optionally, vacuum all database
	/usr/lib{64}/postgresql18/18/bin/vacuumdb -U postgres --all --analyze-in-stages --missing-stats-only
        /usr/lib{64}/postgresql18/18/bin/vacuumdb -U postgres --all --analyze-only
	To remove old's cluster data files, run:
	./delete_old_cluster.sh
  - Remove old package when transition is over, or read comments in
    rc.postgresql  if you want to run multiple PostgreSQL versions in parallel
  - If you encounter a collation version mismatch after logging to psql, you can rebuild all objects in the database using this commands:
    REINDEX DATABASE <DB-Name>;
    ALTER DATABASE <DB-Name> REFRESH COLLATION VERSION;
    
This script builds postgresql with some useful extension modules from
the contrib directory, see PG_EXTENSIONS in SlackBuild file.
To build PostgreSQL with all extensions, use the following command:

	# PG_EXTENSIONS=ALL ./postgresql.SlackBuild

Please note that in order to actually use extension, you must execute
'CREATE EXTENSION [ IF NOT EXISTS ] extension_name' for each extension.
