Expand description
dirty hacks
Modules§
Macros§
- Log to Postgres’
fatal
log level. This will abort the current Postgres backend connection process. - Log to Postgres’
panic
log level. This will cause the entire Postgres cluster to crash. - If an interrupt is pending (perhaps a user-initiated “cancel query” message to this backend), this will safely abort the current transaction
- Log to Postgres’
debug1
log level. - Log to Postgres’
debug2
log level. - Log to Postgres’
debug3
log level. - Log to Postgres’
debug4
log level. - Log to Postgres’
debug5
log level. - Sends some kind of message to Postgres, and if it’s a PgLogLevel::ERROR or greater, Postgres’ error handling takes over and, in the case of PgLogLevel::ERROR, aborts the current transaction.
- Log to Postgres’
error
log level. This will abort the current Postgres transaction. - This macro returns the name of the enclosing function. As the internal implementation is based on the
std::any::type_name
, this macro derives all the limitations of this function. - Log to Postgres’
info
log level. - Log to Postgres’
log
log level. - Log to Postgres’
notice
log level. - Log to Postgres’
warning
log level.
Structs§
- Datum is an abstract value that is effectively a union of all scalar types and all possible pointers in a Postgres context. That is, it is either “pass-by-value” (if the value fits into the platform’s
uintptr_t
) or “pass-by-reference” (if it does not). - Optimizable Statements
- This struct consists of a Datum and a bool, matching Postgres’s definition as of Postgres 12. This isn’t efficient in terms of storage size, due to padding, but sometimes it’s more cache-friendly, so sometimes it is the preferred type.
- An object identifier in Postgres.
- Node and structure definitions
- Query Tree
- Raw Grammar Output Statements
- Supporting data structures for Parse Trees
Enums§
Constants§
- this comes from
postgres_ext.h
Statics§
- System interrupt and critical section handling
- globals.h – *
Traits§
- A trait for converting a thing into a
char *
that is allocated by Postgres’ palloc - A trait applied to all Postgres
pg_sys::Node
types and subtypes
Functions§
- #define BufferGetBlock(buffer)
(
AssertMacro(BufferIsValid(buffer)),
BufferIsLocal(buffer) ?
LocalBufferBlockPointers[-(buffer) - 1]
:
(Block) (BufferBlocks + ((Size) ((buffer) - 1)) * BLCKSZ)
) - #define BufferGetPage(buffer) ((Page)BufferGetBlock(buffer))
- #define BufferIsLocal(buffer) ((buffer) < 0)
- Given a valid HeapTuple pointer, return address of the user data
- Given a currently-allocated chunk of Postgres allocated memory, determine the context it belongs to.
- HeapTupleHeaderGetRawCommandId will give you what’s in the header whether it is useful or not. Most code should use HeapTupleHeaderGetCmin or HeapTupleHeaderGetCmax instead, but note that those Assert that you can get a legitimate result, ie you are in the originating transaction!
- Does the specified
HeapTupleHeaderData
represent a “frozen” tuple? - How many attributes does the specified [
HeapTupleHeader
] have? - HeapTupleHeaderGetRawXmin returns the “raw” xmin field, which is the xid originally used to insert the tuple. However, the tuple might actually be frozen (via HeapTupleHeaderSetXminFrozen) in which case the tuple’s xmin is visible to every snapshot. Prior to PostgreSQL 9.4, we actually changed the xmin to FrozenTransactionId, and that value may still be encountered on disk.
- Returns the
xmin
value of the specifiedHeapTupleHeaderData
- Safety
- Safety
- Safety
- Does the specified [
HeapTuple
] (tup
) contain nulls? - Safety
- Returns true if memory context is tagged correctly according to Postgres.
- __j0⚠
- __j1⚠
- __jn⚠
- __y0⚠
- __y1⚠
- __yn⚠
- bit⚠
- chr⚠
- dcos⚠
- dcot⚠
- dexp⚠
- die⚠
- dpi⚠
- dpow⚠
- dsin⚠
- dtan⚠
- dtof⚠
- fls⚠
- ftod⚠
- Extract an attribute of a heap tuple and return it as a Datum. This works for either system or user attributes. The given attnum is properly range-checked.
- Retrieve the “user data” of the specified [
HeapTuple
] as a specific type. Typically this will be a struct that represents a Postgres system catalog, such as [FormData_pg_class
]. - lpad⚠
- Converts a
pg_sys::NameData
struct into a&str
. - now⚠
- oper⚠
- rpad⚠
Type Aliases§
- Global variable declarations
- Other Statements (no optimizations required)
- pmod.h – * POSTGRES processing mode definitions. *