Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 39 additions & 10 deletions COPYRIGHT
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
PostgreSQL Database Management System
Percona Server for PostgreSQL - License
(also known as Postgres, formerly known as Postgres95)

This software includes portions copyrighted or made available by:
• Percona, LLC and/or its affiliates (collectively, "Percona")
• PostgreSQL Global Development Group ("PostgreSQL")
• The Regents of the University of California

A. PostgreSQL and University of California Portions. Those portions of this Software
copyrighted or made available by PostgreSQL or The Regents of the University of
California are subject to the following:

Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group

Portions Copyright (c) 1994, The Regents of the University of California
Expand All @@ -12,12 +21,32 @@ 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.
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.

B. Percona Portions. Those portions of this Software copyrighted or made available
by Percona are subject both to the disclaimers in part A of this license and the following:

Copyright (c) 2024-2025, Percona LLC and/or its affiliates

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 PERCONA 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 PERCONA HAS BEEN ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.

PERCONA 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 PERCONA HAS NO
OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
35 changes: 25 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
PostgreSQL Database Management System
=====================================
Percona Server for PostgreSQL
=============================

This directory contains the source code distribution of the PostgreSQL
database management system.
Percona Server for PostgreSQL is a free, enhanced, fully compatible,
open source, drop-in replacement for the PostgreSQL Database Management
System with enterprise-grade features.
It requires no changes to PostgreSQL applications or code.

PostgreSQL is an advanced object-relational database management system
that supports an extended subset of the SQL standard, including
Expand All @@ -11,11 +13,24 @@ and functions. This distribution also contains C language bindings.

Copyright and license information can be found in the file COPYRIGHT.

General documentation about this version of PostgreSQL can be found at
<https://www.postgresql.org/docs/18/>. In particular, information
General documentation about this version of Percona Server for PostgreSQL can be found at
[https://docs.percona.com/postgresql/18/](https://docs.percona.com/postgresql/18/). In particular, information
about building PostgreSQL from the source code can be found at
<https://www.postgresql.org/docs/18/installation.html>.
[https://docs.percona.com/postgresql/18/installing.html](https://docs.percona.com/postgresql/18/installing.html).

Submit a bug report or a feature request
---

If you find a bug in Percona Server for PostgreSQL, you can submit a report to the project's
[Jira](https://perconadev.atlassian.net/jira/software/c/projects/PG/issues) issue tracker

As a general rule of thumb, please try to create a bug report that is:

Reproducible - include the steps on how to reproduce the issue

Specific - include as much detail as possible, such as which version, which environment, etc.

Unique - do not duplicate existing tickets

Scoped to a single issue - only one issue per report

The latest version of this software, and related software, may be
obtained at <https://www.postgresql.org/download/>. For more information
look at our web site located at <https://www.postgresql.org/>.
10 changes: 5 additions & 5 deletions config/llvm.m4
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,20 @@ AC_DEFUN([PGAC_LLVM_SUPPORT],

# Collect compiler flags necessary to build the LLVM dependent
# shared library.
for pgac_option in `$LLVM_CONFIG --cppflags`; do
for pgac_option in `$LLVM_CONFIG --link-static --cppflags`; do
case $pgac_option in
-I*|-D*) LLVM_CPPFLAGS="$pgac_option $LLVM_CPPFLAGS";;
esac
done

for pgac_option in `$LLVM_CONFIG --ldflags`; do
for pgac_option in `$LLVM_CONFIG --link-static --ldflags`; do
case $pgac_option in
-L*) LLVM_LIBS="$LLVM_LIBS $pgac_option";;
esac
done

# ABI influencing options, standard influencing options
for pgac_option in `$LLVM_CONFIG --cxxflags`; do
for pgac_option in `$LLVM_CONFIG --link-static --cxxflags`; do
case $pgac_option in
-fno-rtti*) LLVM_CXXFLAGS="$LLVM_CXXFLAGS $pgac_option";;
-std=*) LLVM_CXXFLAGS="$LLVM_CXXFLAGS $pgac_option";;
Expand All @@ -71,7 +71,7 @@ AC_DEFUN([PGAC_LLVM_SUPPORT],
# libs. As some components are optional, we can't just list all of
# them as it'd raise an error.
pgac_components='';
for pgac_component in `$LLVM_CONFIG --components`; do
for pgac_component in `$LLVM_CONFIG --link-static --components`; do
case $pgac_component in
engine) pgac_components="$pgac_components $pgac_component";;
debuginfodwarf) pgac_components="$pgac_components $pgac_component";;
Expand All @@ -85,7 +85,7 @@ AC_DEFUN([PGAC_LLVM_SUPPORT],
# And then get the libraries that need to be linked in for the
# selected components. They're large libraries, we only want to
# link them into the LLVM using shared library.
for pgac_option in `$LLVM_CONFIG --libs --system-libs $pgac_components`; do
for pgac_option in `$LLVM_CONFIG --link-static --libs --system-libs $pgac_components`; do
case $pgac_option in
-l*) LLVM_LIBS="$LLVM_LIBS $pgac_option";;
esac
Expand Down
21 changes: 14 additions & 7 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -2885,6 +2885,13 @@ cat >>confdefs.h <<_ACEOF
_ACEOF


PG_PERCONAVERSION=1

cat >>confdefs.h <<_ACEOF
#define PG_PERCONAVERSION "$PG_PERCONAVERSION"
_ACEOF





Expand All @@ -2899,12 +2906,12 @@ if test "${with_extra_version+set}" = set; then :
as_fn_error $? "argument required for --with-extra-version option" "$LINENO" 5
;;
*)
PG_VERSION="$PACKAGE_VERSION$withval"
PG_VERSION="$PACKAGE_VERSION - Percona Server for PostgreSQL $PG_MAJORVERSION.$PG_MINORVERSION.$PG_PERCONAVERSION$withval"
;;
esac

else
PG_VERSION="$PACKAGE_VERSION"
PG_VERSION="$PACKAGE_VERSION - Percona Server for PostgreSQL $PG_MAJORVERSION.$PG_MINORVERSION.$PG_PERCONAVERSION"
fi


Expand Down Expand Up @@ -5186,20 +5193,20 @@ fi

# Collect compiler flags necessary to build the LLVM dependent
# shared library.
for pgac_option in `$LLVM_CONFIG --cppflags`; do
for pgac_option in `$LLVM_CONFIG --link-static --cppflags`; do
case $pgac_option in
-I*|-D*) LLVM_CPPFLAGS="$pgac_option $LLVM_CPPFLAGS";;
esac
done

for pgac_option in `$LLVM_CONFIG --ldflags`; do
for pgac_option in `$LLVM_CONFIG --link-static --ldflags`; do
case $pgac_option in
-L*) LLVM_LIBS="$LLVM_LIBS $pgac_option";;
esac
done

# ABI influencing options, standard influencing options
for pgac_option in `$LLVM_CONFIG --cxxflags`; do
for pgac_option in `$LLVM_CONFIG --link-static --cxxflags`; do
case $pgac_option in
-fno-rtti*) LLVM_CXXFLAGS="$LLVM_CXXFLAGS $pgac_option";;
-std=*) LLVM_CXXFLAGS="$LLVM_CXXFLAGS $pgac_option";;
Expand All @@ -5210,7 +5217,7 @@ fi
# libs. As some components are optional, we can't just list all of
# them as it'd raise an error.
pgac_components='';
for pgac_component in `$LLVM_CONFIG --components`; do
for pgac_component in `$LLVM_CONFIG --link-static --components`; do
case $pgac_component in
engine) pgac_components="$pgac_components $pgac_component";;
debuginfodwarf) pgac_components="$pgac_components $pgac_component";;
Expand All @@ -5224,7 +5231,7 @@ fi
# And then get the libraries that need to be linked in for the
# selected components. They're large libraries, we only want to
# link them into the LLVM using shared library.
for pgac_option in `$LLVM_CONFIG --libs --system-libs $pgac_components`; do
for pgac_option in `$LLVM_CONFIG --link-static --libs --system-libs $pgac_components`; do
case $pgac_option in
-l*) LLVM_LIBS="$LLVM_LIBS $pgac_option";;
esac
Expand Down
7 changes: 5 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,12 @@ AC_DEFINE_UNQUOTED(PG_MAJORVERSION, "$PG_MAJORVERSION", [PostgreSQL major versio
AC_DEFINE_UNQUOTED(PG_MAJORVERSION_NUM, $PG_MAJORVERSION, [PostgreSQL major version number])
AC_DEFINE_UNQUOTED(PG_MINORVERSION_NUM, $PG_MINORVERSION, [PostgreSQL minor version number])

[PG_PERCONAVERSION=1]
AC_DEFINE_UNQUOTED(PG_PERCONAVERSION, "$PG_PERCONAVERSION", [PostgreSQL Percona version as a string])

PGAC_ARG_REQ(with, extra-version, [STRING], [append STRING to version],
[PG_VERSION="$PACKAGE_VERSION$withval"],
[PG_VERSION="$PACKAGE_VERSION"])
[PG_VERSION="$PACKAGE_VERSION - Percona Server for PostgreSQL $PG_MAJORVERSION.$PG_MINORVERSION.$PG_PERCONAVERSION$withval"],
[PG_VERSION="$PACKAGE_VERSION - Percona Server for PostgreSQL $PG_MAJORVERSION.$PG_MINORVERSION.$PG_PERCONAVERSION"])
AC_DEFINE_UNQUOTED(PG_VERSION, "$PG_VERSION", [PostgreSQL version as a string])

AC_CANONICAL_HOST
Expand Down
3 changes: 2 additions & 1 deletion contrib/amcheck/verify_heapam.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "access/multixact.h"
#include "access/relation.h"
#include "access/table.h"
#include "access/tableam.h"
#include "access/toast_internals.h"
#include "access/visibilitymap.h"
#include "access/xact.h"
Expand Down Expand Up @@ -343,7 +344,7 @@ verify_heapam(PG_FUNCTION_ARGS)
* Other relkinds might be using a different AM, so check.
*/
if (ctx.rel->rd_rel->relkind != RELKIND_SEQUENCE &&
ctx.rel->rd_rel->relam != HEAP_TABLE_AM_OID)
ctx.rel->rd_tableam != GetHeapamTableAmRoutine())
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("only heap AM is supported")));
Expand Down
3 changes: 2 additions & 1 deletion contrib/pageinspect/heapfuncs.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

#include "access/htup_details.h"
#include "access/relation.h"
#include "access/tableam.h"
#include "catalog/pg_am_d.h"
#include "catalog/pg_type.h"
#include "funcapi.h"
Expand Down Expand Up @@ -333,7 +334,7 @@ tuple_data_split_internal(Oid relid, char *tupdata,
* Sequences always use heap AM, but they don't show that in the catalogs.
*/
if (rel->rd_rel->relkind != RELKIND_SEQUENCE &&
rel->rd_rel->relam != HEAP_TABLE_AM_OID)
rel->rd_tableam != GetHeapamTableAmRoutine())
ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("only heap AM is supported")));

Expand Down
3 changes: 2 additions & 1 deletion contrib/pg_surgery/heap_surgery.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#include "access/htup_details.h"
#include "access/relation.h"
#include "access/tableam.h"
#include "access/visibilitymap.h"
#include "access/xloginsert.h"
#include "catalog/pg_am_d.h"
Expand Down Expand Up @@ -115,7 +116,7 @@ heap_force_common(FunctionCallInfo fcinfo, HeapTupleForceOption heap_force_opt)
RelationGetRelationName(rel)),
errdetail_relkind_not_supported(rel->rd_rel->relkind)));

if (rel->rd_rel->relam != HEAP_TABLE_AM_OID)
if (rel->rd_tableam != GetHeapamTableAmRoutine())
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("only heap AM is supported")));
Expand Down
2 changes: 1 addition & 1 deletion contrib/pgrowlocks/pgrowlocks.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ pgrowlocks(PG_FUNCTION_ARGS)
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg("\"%s\" is not a table",
RelationGetRelationName(rel))));
else if (rel->rd_rel->relam != HEAP_TABLE_AM_OID)
else if (rel->rd_tableam != GetHeapamTableAmRoutine())
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("only heap AM is supported")));
Expand Down
2 changes: 1 addition & 1 deletion contrib/pgstattuple/pgstatapprox.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ pgstattuple_approx_internal(Oid relid, FunctionCallInfo fcinfo)
RelationGetRelationName(rel)),
errdetail_relkind_not_supported(rel->rd_rel->relkind)));

if (rel->rd_rel->relam != HEAP_TABLE_AM_OID)
if (rel->rd_tableam != GetHeapamTableAmRoutine())
ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("only heap AM is supported")));

Expand Down
2 changes: 1 addition & 1 deletion contrib/pgstattuple/pgstattuple.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ pgstat_heap(Relation rel, FunctionCallInfo fcinfo)
* Sequences always use heap AM, but they don't show that in the catalogs.
*/
if (rel->rd_rel->relkind != RELKIND_SEQUENCE &&
rel->rd_rel->relam != HEAP_TABLE_AM_OID)
rel->rd_tableam != GetHeapamTableAmRoutine())
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("only heap AM is supported")));
Expand Down
4 changes: 3 additions & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ endif
pg_version_major = pg_version_arr[0].to_int()
pg_version_minor = pg_version_arr[1].to_int()
pg_version_num = (pg_version_major * 10000) + pg_version_minor
pg_percona_ver = '1'

pg_url = 'https://www.postgresql.org/'

Expand All @@ -145,6 +146,7 @@ cdata.set_quoted('PACKAGE_VERSION', pg_version)
cdata.set_quoted('PACKAGE_STRING', 'PostgreSQL @0@'.format(pg_version))
cdata.set_quoted('PACKAGE_TARNAME', 'postgresql')

pg_version += ' - Percona Server for PostgreSQL ' + pg_version_major.to_string() + '.' + pg_version_minor.to_string() + '.' + pg_percona_ver
pg_version += get_option('extra_version')
cdata.set_quoted('PG_VERSION', pg_version)
cdata.set_quoted('PG_MAJORVERSION', pg_version_major.to_string())
Expand Down Expand Up @@ -808,7 +810,7 @@ endif
llvmopt = get_option('llvm')
llvm = not_found_dep
if add_languages('cpp', required: llvmopt, native: false)
llvm = dependency('llvm', version: '>=14', method: 'config-tool', required: llvmopt)
llvm = dependency('llvm', version: '>=14', method: 'config-tool', required: llvmopt, static: true)

if llvm.found()

Expand Down
10 changes: 6 additions & 4 deletions src/backend/access/heap/heapam_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,8 @@ heapam_relation_set_new_filelocator(Relation rel,
{
SMgrRelation srel;

RelFileLocator oldlocator = rel->rd_locator;

/*
* Initialize to the minimum XID that could put tuples in the table. We
* know that no xacts older than RecentXmin are still running, so that
Expand All @@ -605,7 +607,7 @@ heapam_relation_set_new_filelocator(Relation rel,
*/
*minmulti = GetOldestMultiXactId();

srel = RelationCreateStorage(*newrlocator, persistence, true);
srel = RelationCreateStorage2(oldlocator, *newrlocator, persistence, true);

/*
* If required, set up an init fork for an unlogged table so that it can
Expand All @@ -615,7 +617,7 @@ heapam_relation_set_new_filelocator(Relation rel,
{
Assert(rel->rd_rel->relkind == RELKIND_RELATION ||
rel->rd_rel->relkind == RELKIND_TOASTVALUE);
smgrcreate(srel, INIT_FORKNUM, false);
smgrcreate2(oldlocator, srel, INIT_FORKNUM, false);
log_smgrcreate(newrlocator, INIT_FORKNUM);
}

Expand Down Expand Up @@ -648,7 +650,7 @@ heapam_relation_copy_data(Relation rel, const RelFileLocator *newrlocator)
* NOTE: any conflict in relfilenumber value will be caught in
* RelationCreateStorage().
*/
dstrel = RelationCreateStorage(*newrlocator, rel->rd_rel->relpersistence, true);
dstrel = RelationCreateStorage2(rel->rd_locator, *newrlocator, rel->rd_rel->relpersistence, true);

/* copy main fork */
RelationCopyStorage(RelationGetSmgr(rel), dstrel, MAIN_FORKNUM,
Expand All @@ -660,7 +662,7 @@ heapam_relation_copy_data(Relation rel, const RelFileLocator *newrlocator)
{
if (smgrexists(RelationGetSmgr(rel), forkNum))
{
smgrcreate(dstrel, forkNum, false);
smgrcreate2(rel->rd_locator, dstrel, forkNum, false);

/*
* WAL log creation if the relation is persistent, or this is the
Expand Down
Loading