![]() |
ProvSQL C/C++ API
Adding support for provenance and uncertainty management to PostgreSQL databases
|
PostgreSQL cross-version compatibility shims for ProvSQL. More...
#include "postgres.h"#include "nodes/pg_list.h"#include "catalog/namespace.h"

Go to the source code of this file.
Macros | |
| #define | F_COUNT_ANY 2147 |
OID of count(*) / count(any) aggregate function (pre-PG 14). | |
| #define | F_COUNT_ 2803 |
OID of count() aggregate function (pre-PG 14). | |
| #define | F_SUM_INT4 2108 |
OID of sum(int4) aggregate function (pre-PG 14). | |
| #define | TYPALIGN_INT 'i' |
Alignment codes for the array routines (construct_array / deconstruct_array). | |
| #define | TYPALIGN_CHAR 'c' |
| #define | F_ARRAY_AGG_ANYNONARRAY 2335 |
OID of the array_agg(anynonarray) aggregate (pre-PG 14). | |
Functions | |
| static List * | my_list_delete_cell (List *list, ListCell *cell, ListCell *prev) |
Version-agnostic wrapper around list_delete_cell(). | |
| static ListCell * | my_lnext (const List *l, const ListCell *c) |
Version-agnostic wrapper around lnext(). | |
| static FuncCandidateList | FuncnameGetCandidatesCompat (List *names, int nargs, List *argnames, bool expand_variadic, bool expand_defaults, bool include_out_arguments, bool missing_ok) |
Version-agnostic wrapper around FuncnameGetCandidates(). | |
| static FuncCandidateList | OpernameGetCandidatesCompat (List *names, char oprkind, bool missing_schema_ok) |
Version-agnostic wrapper around OpernameGetCandidates(). | |
| List * | list_insert_nth (List *list, int pos, void *datum) |
Insert datum at position pos in list (PG < 13 backport). | |
PostgreSQL cross-version compatibility shims for ProvSQL.
ProvSQL supports a range of PostgreSQL major versions. This header centralises the small API differences between those versions so that the rest of the codebase can call a single, stable interface.
Currently handled differences:
list_delete_cell() and lnext() gained or lost a prev argument between PostgreSQL 12 and 13. The my_list_delete_cell() and my_lnext() wrappers hide this.compatibility.c provides a backport.F_COUNT_ANY, F_COUNT_, and F_SUM_INT4 macros were introduced in PostgreSQLlist_make4() + lappend().include_out_arguments parameter to the former; PostgreSQL 19 added a mandatory fgc_flags out-parameter to both. The *Compat wrappers take the PG 14-style argument list and drop / dummy-fill the extra arguments as needed. Definition in file compatibility.h.
| #define F_ARRAY_AGG_ANYNONARRAY 2335 |
OID of the array_agg(anynonarray) aggregate (pre-PG 14).
The F_ARRAY_AGG_ANYNONARRAY macro only exists since PostgreSQL 14, when fmgroids.h gained overload-disambiguated names for aggregates; before that, aggregates had no fmgroids.h entry at all. Same stable OID.
Definition at line 170 of file compatibility.h.
| #define F_COUNT_ 2803 |
OID of count() aggregate function (pre-PG 14).
Definition at line 143 of file compatibility.h.
| #define F_COUNT_ANY 2147 |
OID of count(*) / count(any) aggregate function (pre-PG 14).
Definition at line 141 of file compatibility.h.
| #define F_SUM_INT4 2108 |
OID of sum(int4) aggregate function (pre-PG 14).
Definition at line 145 of file compatibility.h.
| #define TYPALIGN_CHAR 'c' |
Definition at line 161 of file compatibility.h.
| #define TYPALIGN_INT 'i' |
Alignment codes for the array routines (construct_array / deconstruct_array).
The TYPALIGN_* macros (in catalog/pg_type.h) were introduced in PostgreSQL 13; on PG 10-12 the alignment is passed as the older 'i' / 'c' characters.
Definition at line 160 of file compatibility.h.
|
inlinestatic |
Version-agnostic wrapper around FuncnameGetCandidates().
Takes the PostgreSQL 14+ argument list. On PG < 14 the include_out_arguments parameter (added in 14) is dropped; on PG >= 19 the fgc_flags out-parameter (added in 19, must not be NULL) receives a discarded local, as no caller inspects the lookup-failure flags.
Definition at line 85 of file compatibility.h.

| List * list_insert_nth | ( | List * | list, |
| int | pos, | ||
| void * | datum ) |
Insert datum at position pos in list (PG < 13 backport).
PostgreSQL 13 introduced list_insert_nth() when lists were reimplemented as arrays. This declaration provides the same function for older PostgreSQL versions; the implementation lives in compatibility.c.
| list | The list to insert into (may be NIL). |
| pos | Zero-based index at which to insert the new element. |
| datum | The value to insert. |
Definition at line 15 of file compatibility.c.

|
inlinestatic |
Version-agnostic wrapper around list_delete_cell().
PostgreSQL 13 changed list_delete_cell() to no longer require the previous cell pointer (because lists became arrays). This inline helper selects the correct call form at compile time.
| list | The list to modify. |
| cell | The cell to delete. |
| prev | The cell immediately before cell (ignored on PG ≥ 13). |
Definition at line 47 of file compatibility.h.

|
inlinestatic |
Version-agnostic wrapper around lnext().
PostgreSQL 13 added the list pointer parameter to lnext() to support the array-based list implementation. This inline helper selects the correct call form at compile time.
| l | The list (ignored on PG < 13). |
| c | The current cell. |
NULL if c is the last element. Definition at line 66 of file compatibility.h.

|
inlinestatic |
Version-agnostic wrapper around OpernameGetCandidates().
PostgreSQL 19 added an fgc_flags out-parameter (must not be NULL); it receives a discarded local, as no caller inspects the lookup-failure flags.
Definition at line 112 of file compatibility.h.
