40 const char *result =
"<unset>";
41 bool timeout_specified =
false;
42 bool no_throw_specified =
false;
50 if (strcmp(defel->defname,
"timeout") == 0)
56 if (timeout_specified)
58 timeout_specified =
true;
65 errcode(ERRCODE_INVALID_PARAMETER_VALUE),
66 errmsg(
"invalid timeout value: \"%s\"", timeout_str),
67 hintmsg ?
errhint(
"%s",
_(hintmsg)) : 0);
75 result = rint(result);
80 errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
81 errmsg(
"timeout value is out of range"));
85 errcode(ERRCODE_INVALID_PARAMETER_VALUE),
86 errmsg(
"timeout cannot be negative"));
88 timeout = (
int64) result;
90 else if (strcmp(defel->defname,
"no_throw") == 0)
92 if (no_throw_specified)
95 no_throw_specified =
true;
103 errmsg(
"option \"%s\" not recognized",
133 errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
134 errmsg(
"WAIT FOR must be only called without an active or registered snapshot"),
135 errdetail(
"WAIT FOR cannot be executed from a function or a procedure or within a transaction with an isolation level higher than READ COMMITTED."));
148 switch (waitLSNResult)
158 errcode(ERRCODE_QUERY_CANCELED),
159 errmsg(
"timed out while waiting for target LSN %X/%08X to be replayed; current replay LSN %X/%08X",
172 errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
173 errmsg(
"recovery is not in progress"),
174 errdetail(
"Recovery ended before replaying target LSN %X/%08X; last replay LSN %X/%08X.",
180 errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
181 errmsg(
"recovery is not in progress"),
182 errhint(
"Waiting for the replay LSN can only be executed during recovery."));
185 result =
"not in recovery";
#define FLOAT8_FITS_IN_INT64(num)
char * defGetString(DefElem *def)
bool defGetBoolean(DefElem *def)
void errorConflictingDefElem(DefElem *defel, ParseState *pstate)
int errdetail(const char *fmt,...)
int errhint(const char *fmt,...)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
const TupleTableSlotOps TTSOpsVirtual
void end_tup_output(TupOutputState *tstate)
TupOutputState * begin_tup_output_tupdesc(DestReceiver *dest, TupleDesc tupdesc, const TupleTableSlotOps *tts_ops)
#define do_text_output_oneline(tstate, str_to_emit)
#define DirectFunctionCall1(func, arg1)
bool parse_real(const char *value, double *result, int flags, const char **hintmsg)
Assert(PointerIsAligned(start, uint64))
int parser_errposition(ParseState *pstate, int location)
#define foreach_node(type, var, lst)
Datum pg_lsn_in(PG_FUNCTION_ARGS)
static XLogRecPtr DatumGetLSN(Datum X)
static Datum CStringGetDatum(const char *X)
bool ActiveSnapshotSet(void)
bool HaveRegisteredOrActiveSnapshot(void)
void PopActiveSnapshot(void)
void InvalidateCatalogSnapshot(void)
#define InvalidTransactionId
TupleDesc CreateTemplateTupleDesc(int natts)
void TupleDescInitEntry(TupleDesc desc, AttrNumber attributeNumber, const char *attributeName, Oid oidtypeid, int32 typmod, int attdim)
void ExecWaitStmt(ParseState *pstate, WaitStmt *stmt, DestReceiver *dest)
TupleDesc WaitStmtResultDesc(WaitStmt *stmt)
#define LSN_FORMAT_ARGS(lsn)
bool PromoteIsTriggered(void)
XLogRecPtr GetXLogReplayRecPtr(TimeLineID *replayTLI)
WaitLSNResult WaitForLSN(WaitLSNType lsnType, XLogRecPtr targetLSN, int64 timeout)
@ WAIT_LSN_RESULT_NOT_IN_RECOVERY
@ WAIT_LSN_RESULT_TIMEOUT
@ WAIT_LSN_RESULT_SUCCESS