Contents
-
- Data Structures
- Macros
- Typedefs
- Functions
- Detailed Description
- Macro Definition Documentation
- ◆ DATA_PATH
- ◆ DOCS_PATH
- Typedef Documentation
- ◆ Fetch_fn
- Function Documentation
- ◆ veil2_bool_from_query()
- ◆ veil2_datapath()
- ◆ veil2_docpath()
- ◆ veil2_i_have_global_priv()
- ◆ veil2_i_have_personal_priv()
- ◆ veil2_i_have_priv_in_scope()
- ◆ veil2_i_have_priv_in_scope_or_global()
- ◆ veil2_i_have_priv_in_scope_or_superior()
- ◆ veil2_i_have_priv_in_scope_or_superior_or_global()
- ◆ veil2_i_have_priv_in_superior_scope()
- ◆ veil2_query()
- ◆ veil2_query_wn()
- ◆ veil2_reset_session()
- ◆ veil2_reset_session_privs()
- ◆ veil2_result_counts()
- ◆ veil2_session_ready()
- ◆ veil2_spi_connect()
- ◆ veil2_spi_finish()
- ◆ veil2_true()
Veil2
Postgres extension for VPD implementations
|
veil2.h File Reference
Main header file for veil2. More...
#include "extension/pgbitmap/pgbitmap.h"
Include dependency graph for veil2.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Data Structures | |
struct | tuple_2ints |
Macros | |
#define | DOCS_PATH "<path to postgres extension docs>" |
#define | DATA_PATH "<path to postgres extension data files>" |
Typedefs | |
typedef bool() | Fetch_fn(HeapTuple, TupleDesc, void *) |
Functions | |
void | veil2_spi_connect (bool *p_pushed, const char *msg) |
void | veil2_spi_finish (bool pushed, const char *msg) |
int | veil2_query_wn (const char *qry, int nargs, Oid *argtypes, Datum *args, const char *nulls, bool read_only, void **saved_plan, Fetch_fn process_row, void *fn_param) |
int | veil2_query (const char *qry, int nargs, Oid *argtypes, Datum *args, bool read_only, void **saved_plan, Fetch_fn process_row, void *fn_param) |
bool | veil2_bool_from_query (const char *qry, int nargs, Oid *argtypes, Datum *args, void **saved_plan, bool *result) |
Datum | veil2_session_ready (PG_FUNCTION_ARGS) |
Datum | veil2_reset_session (PG_FUNCTION_ARGS) |
Datum | veil2_reset_session_privs (PG_FUNCTION_ARGS) |
Datum | veil2_true (PG_FUNCTION_ARGS) |
Datum | veil2_i_have_global_priv (PG_FUNCTION_ARGS) |
Datum | veil2_i_have_personal_priv (PG_FUNCTION_ARGS) |
Datum | veil2_i_have_priv_in_scope (PG_FUNCTION_ARGS) |
Datum | veil2_i_have_priv_in_scope_or_global (PG_FUNCTION_ARGS) |
Datum | veil2_i_have_priv_in_superior_scope (PG_FUNCTION_ARGS) |
Datum | veil2_i_have_priv_in_scope_or_superior (PG_FUNCTION_ARGS) |
Datum | veil2_i_have_priv_in_scope_or_superior_or_global (PG_FUNCTION_ARGS) |
Datum | veil2_result_counts (PG_FUNCTION_ARGS) |
Datum | veil2_docpath (PG_FUNCTION_ARGS) |
Datum | veil2_datapath (PG_FUNCTION_ARGS) |
Detailed Description
Main header file for veil2.
Author: Marc Munro
Copyright (c) 2020 Marc Munro
License: GPL v3
Definition in file veil2.h.
Macro Definition Documentation
◆ DATA_PATH
◆ DOCS_PATH
Typedef Documentation
◆ Fetch_fn
typedef bool() Fetch_fn(HeapTuple, TupleDesc, void *) |
Function Documentation
◆ veil2_bool_from_query()
bool veil2_bool_from_query | ( | const char * | qry, |
int | nargs, | ||
Oid * | argtypes, | ||
Datum * | args, | ||
void ** | saved_plan, | ||
bool * | result | ||
) |
Executes a query that returns a single bool value.
- Parameters
-
qry The text of the query to be performed. nargs The number of input parameters ($1, $2, etc) to the query argtypes Pointer to an array containing the OIDs of the data args Actual parameters saved_plan Adress of void pointer into which the query plan will be saved. Passing the same void pointer on a subsequent call will cause the saved query plan to be re-used. This may be NULL, in which case the query plan will not be saved. result Variable into which the result of the query will be placed.
- Returns
- true if the query returned a record, false otherwise.
Definition at line 267 of file query.c.
Here is the call graph for this function:

◆ veil2_datapath()
Datum veil2_datapath | ( | PG_FUNCTION_ARGS | ) |
◆ veil2_docpath()
Datum veil2_docpath | ( | PG_FUNCTION_ARGS | ) |
◆ veil2_i_have_global_priv()
Datum veil2_i_have_global_priv | ( | PG_FUNCTION_ARGS | ) |
◆ veil2_i_have_personal_priv()
Datum veil2_i_have_personal_priv | ( | PG_FUNCTION_ARGS | ) |
◆ veil2_i_have_priv_in_scope()
Datum veil2_i_have_priv_in_scope | ( | PG_FUNCTION_ARGS | ) |
◆ veil2_i_have_priv_in_scope_or_global()
Datum veil2_i_have_priv_in_scope_or_global | ( | PG_FUNCTION_ARGS | ) |
◆ veil2_i_have_priv_in_scope_or_superior()
Datum veil2_i_have_priv_in_scope_or_superior | ( | PG_FUNCTION_ARGS | ) |
◆ veil2_i_have_priv_in_scope_or_superior_or_global()
Datum veil2_i_have_priv_in_scope_or_superior_or_global | ( | PG_FUNCTION_ARGS | ) |
◆ veil2_i_have_priv_in_superior_scope()
Datum veil2_i_have_priv_in_superior_scope | ( | PG_FUNCTION_ARGS | ) |
◆ veil2_query()
int veil2_query | ( | const char * | qry, |
int | nargs, | ||
Oid * | argtypes, | ||
Datum * | args, | ||
bool | read_only, | ||
void ** | saved_plan, | ||
Fetch_fn | process_row, | ||
void * | fn_param | ||
) |
Execute a query (with all args being non-null) and process the results.
- Parameters
-
qry The text of the SQL query to be performed. nargs The number of input parameters ($1, $2, etc) to the query argtypes Pointer to an array containing the OIDs of the data args Actual parameters types of the parameters read_only Whether the query should be read-only or not. saved_plan Adress of void pointer into which the query plan will be saved. Passing the same void pointer on a subsequent call will cause the saved query plan to be re-used. This may be NULL, in which case the query plan will not be saved. process_row A Fetch_fn() to process each tuple retruned by the query. fn_param A parameter to pass to process_row.
- Returns
- The number of rows processed.
Definition at line 218 of file query.c.
Here is the call graph for this function:

◆ veil2_query_wn()
int veil2_query_wn | ( | const char * | qry, |
int | nargs, | ||
Oid * | argtypes, | ||
Datum * | args, | ||
const char * | nulls, | ||
bool | read_only, | ||
void ** | saved_plan, | ||
Fetch_fn | process_row, | ||
void * | fn_param | ||
) |
Execute a query with nulls (ie allowing null arguments) and process the results.
- Parameters
-
qry The text of the SQL query to be performed. nargs The number of input parameters ($1, $2, etc) to the query argtypes Pointer to an array containing the OIDs of the data args Actual parameters types of the parameters nulls String identifying which args are null. Null args contain 'n' in the appropriate character position, otherwise there will be a space. If no args may be null, a NULL value can be used instead of a string. read_only Whether the query should be read-only or not. saved_plan Adress of void pointer into which the query plan will be saved. Passing the same void pointer on a subsequent call will cause the saved query plan to be re-used. This may be NULL, in which case the query plan will not be saved. process_row A Fetch_fn() to process each tuple retruned by the query. fn_param A parameter to pass to process_row.
- Returns
- The number of rows processed.
Definition at line 165 of file query.c.
Here is the call graph for this function:

◆ veil2_reset_session()
Datum veil2_reset_session | ( | PG_FUNCTION_ARGS | ) |
◆ veil2_reset_session_privs()
Datum veil2_reset_session_privs | ( | PG_FUNCTION_ARGS | ) |
◆ veil2_result_counts()
Datum veil2_result_counts | ( | PG_FUNCTION_ARGS | ) |
◆ veil2_session_ready()
Datum veil2_session_ready | ( | PG_FUNCTION_ARGS | ) |
◆ veil2_spi_connect()
void veil2_spi_connect | ( | bool * | p_pushed, |
const char * | msg | ||
) |
If already connected in this session, push the current connection, and get a new one. We are already connected, if:
- are within a query
- and the current transaction id matches the saved transaction id
- Parameters
-
p_pushed Pointer to a boolean into which we will record whether we have saved a presiously active SPI connection. This allows recursive queries, which is probably overkill for our needs, but since the overhead is low... msg An error message string to be issued in the event of a failure.
- Returns
- integer giving an SPI error code or success.
◆ veil2_spi_finish()
void veil2_spi_finish | ( | bool | pushed, |
const char * | msg | ||
) |
Reciprocal function for veil2_spi_connect()
- Parameters
-
pushed Boolean as set up by veil2_spi_connect(). This tells us whether to revert to a previously active SPI connection. msg An error message string to be issued in the event of a failure.
- Returns
- integer giving an SPI error code or success.
◆ veil2_true()
Datum veil2_true | ( | PG_FUNCTION_ARGS | ) |