![]() |
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"

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). | |
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(). | |
| 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 PostgreSQLDefinition in file compatibility.h.
| #define F_COUNT_ 2803 |
OID of count() aggregate function (pre-PG 14).
Definition at line 87 of file compatibility.h.
| #define F_COUNT_ANY 2147 |
OID of count(*) / count(any) aggregate function (pre-PG 14).
Definition at line 85 of file compatibility.h.
| #define F_SUM_INT4 2108 |
OID of sum(int4) aggregate function (pre-PG 14).
Definition at line 89 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 38 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 57 of file compatibility.h.
