![]() |
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_ROW_NUMBER 3100 |
OIDs of the ranking window functions (pre-PG 14, where fmgroids.h names them after their C symbols, F_WINDOW_RANK...). | |
| #define | F_RANK_ 3101 |
| #define | F_DENSE_RANK_ 3102 |
| #define | F_CUME_DIST_ 3104 |
OID of the cume_dist() window function (pre-PG 14, where fmgroids.h names it F_WINDOW_CUME_DIST). | |
| #define | F_NTILE 3105 |
OID of the ntile() window function (pre-PG 14, where fmgroids.h names it F_WINDOW_NTILE). | |
| #define | F_PERCENT_RANK_ 3103 |
OID of the percent_rank() window function (pre-PG 14, where fmgroids.h names it F_WINDOW_PERCENT_RANK). | |
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(). | |
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_CUME_DIST_ 3104 |
OID of the cume_dist() window function (pre-PG 14, where fmgroids.h names it F_WINDOW_CUME_DIST).
Definition at line 191 of file compatibility.h.
| #define F_DENSE_RANK_ 3102 |
Definition at line 185 of file compatibility.h.
| #define F_NTILE 3105 |
OID of the ntile() window function (pre-PG 14, where fmgroids.h names it F_WINDOW_NTILE).
Definition at line 197 of file compatibility.h.
| #define F_PERCENT_RANK_ 3103 |
OID of the percent_rank() window function (pre-PG 14, where fmgroids.h names it F_WINDOW_PERCENT_RANK).
Definition at line 203 of file compatibility.h.
| #define F_RANK_ 3101 |
Definition at line 184 of file compatibility.h.
| #define F_ROW_NUMBER 3100 |
OIDs of the ranking window functions (pre-PG 14, where fmgroids.h names them after their C symbols, F_WINDOW_RANK...).
Definition at line 183 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.

|
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.
