PostgreSQL Source Code git master
Macros | Typedefs | Functions
pg_lsn.h File Reference
#include "access/xlogdefs.h"
#include "fmgr.h"
Include dependency graph for pg_lsn.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

 
#define  PG_RETURN_LSN(x)   return LSNGetDatum(x)
 

Typedefs

typedef struct Node  Node
 

Functions

 
 
XLogRecPtr  pg_lsn_in_safe (const char *str, Node *escontext)
 

Macro Definition Documentation

PG_GETARG_LSN

#define PG_GETARG_LSN (   n )    DatumGetLSN(PG_GETARG_DATUM(n))

Definition at line 36 of file pg_lsn.h.

PG_RETURN_LSN

#define PG_RETURN_LSN (   x )    return LSNGetDatum(x)

Definition at line 37 of file pg_lsn.h.

Typedef Documentation

Node

typedef struct Node Node

Definition at line 22 of file pg_lsn.h.

Function Documentation

DatumGetLSN()

static XLogRecPtr DatumGetLSN ( Datum  X )
inlinestatic

Definition at line 25 of file pg_lsn.h.

26{
27 return (XLogRecPtr) DatumGetInt64(X);
28}
static int64 DatumGetInt64(Datum X)
Definition: postgres.h:393
uint64 XLogRecPtr
Definition: xlogdefs.h:21

References DatumGetInt64().

Referenced by GetSubscriptionRelations(), GetSubscriptionRelState(), libpqrcv_create_slot(), parse_subscription_options(), and synchronize_slots().

LSNGetDatum()

static Datum LSNGetDatum ( XLogRecPtr  X )
inlinestatic

Definition at line 31 of file pg_lsn.h.

32{
33 return Int64GetDatum((int64) X);
34}
int64_t int64
Definition: c.h:535
static Datum Int64GetDatum(int64 X)
Definition: postgres.h:403

References Int64GetDatum().

Referenced by AddSubscriptionRelState(), AlterSubscription(), clear_subscription_skip_lsn(), copy_replication_slot(), CreateSubscription(), GetWALBlockInfo(), GetWALRecordInfo(), gist_page_opaque_info(), LogicalOutputWrite(), page_header(), pg_available_wal_summaries(), pg_backup_stop(), pg_control_checkpoint(), pg_control_recovery(), pg_create_logical_replication_slot(), pg_create_physical_replication_slot(), pg_get_logical_snapshot_info(), pg_get_replication_slots(), pg_get_wal_summarizer_state(), pg_replication_slot_advance(), pg_show_replication_origin_status(), pg_stat_get_subscription(), pg_stat_get_wal_receiver(), pg_stat_get_wal_senders(), and UpdateSubscriptionRelState().

pg_lsn_in_safe()

XLogRecPtr pg_lsn_in_safe ( const char *  str,
Nodeescontext 
)

Definition at line 32 of file pg_lsn.c.

33{
34 int len1,
35 len2;
36 uint32 id,
37 off;
38 XLogRecPtr result;
39
40 /* Sanity check input format. */
41 len1 = strspn(str, "0123456789abcdefABCDEF");
42 if (len1 < 1 || len1 > MAXPG_LSNCOMPONENT || str[len1] != '/')
43 goto syntax_error;
44
45 len2 = strspn(str + len1 + 1, "0123456789abcdefABCDEF");
46 if (len2 < 1 || len2 > MAXPG_LSNCOMPONENT || str[len1 + 1 + len2] != '0円')
47 goto syntax_error;
48
49 /* Decode result. */
50 id = (uint32) strtoul(str, NULL, 16);
51 off = (uint32) strtoul(str + len1 + 1, NULL, 16);
52 result = ((uint64) id << 32) | off;
53
54 return result;
55
57 ereturn(escontext, InvalidXLogRecPtr,
58 (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
59 errmsg("invalid input syntax for type %s: \"%s\"",
60 "pg_lsn", str)));
61}
uint64_t uint64
Definition: c.h:539
uint32_t uint32
Definition: c.h:538
int errcode(int sqlerrcode)
Definition: elog.c:854
int errmsg(const char *fmt,...)
Definition: elog.c:1071
#define ereturn(context, dummy_value,...)
Definition: elog.h:278
const char * str
#define MAXPG_LSNCOMPONENT
Definition: pg_lsn.c:22
void syntax_error(const char *source, int lineno, const char *line, const char *command, const char *msg, const char *more, int column)
Definition: pgbench.c:5551
#define InvalidXLogRecPtr
Definition: xlogdefs.h:28

References ereturn, errcode(), errmsg(), InvalidXLogRecPtr, MAXPG_LSNCOMPONENT, str, and syntax_error().

Referenced by check_recovery_target_lsn(), and pg_lsn_in().

AltStyle によって変換されたページ (->オリジナル) /