29#include "catalog/system_fk_info.h"
44#include "utils/fmgroids.h"
126 if ((*bitmap & bitmask) == 0)
130 if (bitmask == 0x100)
198 (
errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
199 errmsg(
"null value not allowed")));
248 if (tablespaceOid == GLOBALTABLESPACE_OID)
251 (
errmsg(
"global tablespace never has databases")));
256 if (tablespaceOid == DEFAULTTABLESPACE_OID)
270 errmsg(
"could not open directory \"%s\": %m",
273 (
errmsg(
"%u is not a tablespace OID", tablespaceOid)));
278 while ((de =
ReadDir(dirdesc, location)) != NULL)
292 subdir =
psprintf(
"%s/%s", location, de->d_name);
342 if (isnan(secs) || secs <= 0.0)
373 delay_ms = (long) ((delay + 999) / 1000);
380 WAIT_EVENT_PG_SLEEP);
402 elog(
ERROR,
"return type must be a row type");
429 values[3] =
_(
"unreserved (cannot be function or type name)");
433 values[3] =
_(
"reserved (can be function or type name)");
448 values[4] =
_(
"can be bare label");
481 elog(
ERROR,
"return type must be a row type");
502 const SysFKRelationship *fkrel = &sys_fk_relationships[funcctx->
call_cntr];
507 memset(nulls,
false,
sizeof(nulls));
570 if (typTup->typtype != TYPTYPE_DOMAIN)
577 typid = typTup->typbasetype;
600 (
errcode(ERRCODE_DATATYPE_MISMATCH),
601 errmsg(
"collations are not supported by type %s",
652#define REQ_EVENTS ((1 << CMD_UPDATE) | (1 << CMD_DELETE))
697 elog(
ERROR,
"return type must be a row type");
704 memset(isnull,
true,
sizeof(isnull));
713 memset(isnull,
false,
sizeof(isnull));
749 if (my_extra == NULL)
773 if (my_extra->
typoid != typoid)
780 my_extra->
typoid = typoid;
804 if ((
c >=
'a' &&
c <=
'z') || (
c >=
'A' &&
c <=
'Z'))
820 if ((
c >=
'0' &&
c <=
'9') ||
c ==
'$')
839 bool after_dot =
false;
846 nextp = qualname_str;
855 bool missing_ident =
true;
864 endp = strchr(nextp + 1,
'"');
867 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
868 errmsg(
"string is not a valid identifier: \"%s\"",
870 errdetail(
"String has unclosed double quotes.")));
873 memmove(endp, endp + 1, strlen(endp));
879 if (endp - curname == 0)
881 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
882 errmsg(
"string is not a valid identifier: \"%s\"",
884 errdetail(
"Quoted identifier must not be empty.")));
888 missing_ident =
false;
900 len = nextp - curname;
912 missing_ident =
false;
920 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
921 errmsg(
"string is not a valid identifier: \"%s\"",
923 errdetail(
"No valid identifier before \".\".")));
926 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
927 errmsg(
"string is not a valid identifier: \"%s\"",
929 errdetail(
"No valid identifier after \".\".")));
932 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
933 errmsg(
"string is not a valid identifier: \"%s\"",
947 else if (*nextp ==
'\0')
955 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
956 errmsg(
"string is not a valid identifier: \"%s\"",
984 if (strcmp(logfmt,
"stderr") != 0 &&
985 strcmp(logfmt,
"csvlog") != 0 &&
986 strcmp(logfmt,
"jsonlog") != 0)
988 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
989 errmsg(
"log format \"%s\" is not supported", logfmt),
990 errhint(
"The supported log formats are \"stderr\", \"csvlog\", and \"jsonlog\".")));
999 errmsg(
"could not read file \"%s\": %m",
1006 _setmode(_fileno(
fd), _O_TEXT);
1013 while (fgets(lbuffer,
sizeof(lbuffer),
fd) != NULL)
1020 log_format = lbuffer;
1021 log_filepath = strchr(lbuffer,
' ');
1022 if (log_filepath == NULL)
1030 *log_filepath =
'\0';
1032 nlpos = strchr(log_filepath,
'\n');
1042 if (logfmt == NULL || strcmp(logfmt, log_format) == 0)
#define PG_GETARG_ARRAYTYPE_P(n)
#define ARR_NULLBITMAP(a)
ArrayBuildState * accumArrayResult(ArrayBuildState *astate, Datum dvalue, bool disnull, Oid element_type, MemoryContext rcontext)
Datum makeArrayResult(ArrayBuildState *astate, MemoryContext rcontext)
int ArrayGetNItems(int ndim, const int *dims)
bool directory_is_empty(const char *path)
Datum pg_typeof(PG_FUNCTION_ARGS)
struct ValidIOData ValidIOData
Datum parse_ident(PG_FUNCTION_ARGS)
static bool count_nulls(FunctionCallInfo fcinfo, int32 *nargs, int32 *nulls)
Datum pg_tablespace_databases(PG_FUNCTION_ARGS)
static bool is_ident_cont(unsigned char c)
Datum current_query(PG_FUNCTION_ARGS)
Datum pg_get_catalog_foreign_keys(PG_FUNCTION_ARGS)
static bool pg_input_is_valid_common(FunctionCallInfo fcinfo, text *txt, text *typname, ErrorSaveContext *escontext)
Datum pg_input_error_info(PG_FUNCTION_ARGS)
Datum pg_input_is_valid(PG_FUNCTION_ARGS)
Datum any_value_transfn(PG_FUNCTION_ARGS)
Datum pg_sleep(PG_FUNCTION_ARGS)
Datum pg_get_replica_identity_index(PG_FUNCTION_ARGS)
Datum pg_current_logfile(PG_FUNCTION_ARGS)
Datum pg_get_keywords(PG_FUNCTION_ARGS)
static bool is_ident_start(unsigned char c)
Datum current_database(PG_FUNCTION_ARGS)
Datum pg_column_is_updatable(PG_FUNCTION_ARGS)
Datum pg_num_nulls(PG_FUNCTION_ARGS)
Datum pg_basetype(PG_FUNCTION_ARGS)
Datum pg_current_logfile_1arg(PG_FUNCTION_ARGS)
Datum pg_tablespace_location(PG_FUNCTION_ARGS)
Datum pg_relation_is_updatable(PG_FUNCTION_ARGS)
Datum pg_collation_for(PG_FUNCTION_ARGS)
Datum pg_error_on_null(PG_FUNCTION_ARGS)
Datum pg_num_nonnulls(PG_FUNCTION_ARGS)
TimestampTz GetCurrentTimestamp(void)
Bitmapset * bms_make_singleton(int x)
static Datum values[MAXATTR]
#define CStringGetTextDatum(s)
#define unconstify(underlying_type, expr)
#define IS_HIGHBIT_SET(ch)
#define OidIsValid(objectId)
const uint8 ScanKeywordCategories[SCANKEYWORDS_NUM_KEYWORDS]
const bool ScanKeywordBareLabel[SCANKEYWORDS_NUM_KEYWORDS]
int errcode_for_file_access(void)
int errdetail(const char *fmt,...)
int errhint(const char *fmt,...)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
char * unpack_sql_state(int sql_state)
#define ereport(elevel,...)
TupleDesc BlessTupleDesc(TupleDesc tupdesc)
HeapTuple BuildTupleFromCStrings(AttInMetadata *attinmeta, char **values)
AttInMetadata * TupleDescGetAttInMetadata(TupleDesc tupdesc)
DIR * AllocateDir(const char *dirname)
struct dirent * ReadDir(DIR *dir, const char *dirname)
FILE * AllocateFile(const char *name, const char *mode)
bool get_fn_expr_arg_stable(FmgrInfo *flinfo, int argnum)
void fmgr_info(Oid functionId, FmgrInfo *finfo)
void fmgr_info_cxt(Oid functionId, FmgrInfo *finfo, MemoryContext mcxt)
bool InputFunctionCallSafe(FmgrInfo *flinfo, char *str, Oid typioparam, int32 typmod, Node *escontext, Datum *result)
bool get_fn_expr_variadic(FmgrInfo *flinfo)
Oid get_fn_expr_argtype(FmgrInfo *flinfo, int argnum)
#define PG_GETARG_TEXT_PP(n)
#define PG_GETARG_FLOAT8(n)
#define PG_GETARG_DATUM(n)
#define PG_RETURN_TEXT_P(x)
#define PG_RETURN_INT32(x)
#define PG_RETURN_NAME(x)
#define PG_GETARG_BOOL(n)
#define PG_RETURN_DATUM(x)
#define PG_GET_COLLATION()
#define FunctionCall3(flinfo, arg1, arg2, arg3)
#define PG_RETURN_BOOL(x)
#define PG_GETARG_INT16(n)
void InitMaterializedSRF(FunctionCallInfo fcinfo, bits32 flags)
TypeFuncClass get_call_result_type(FunctionCallInfo fcinfo, Oid *resultTypeId, TupleDesc *resultTupleDesc)
#define SRF_IS_FIRSTCALL()
#define SRF_PERCALL_SETUP()
#define SRF_RETURN_NEXT(_funcctx, _result)
#define SRF_FIRSTCALL_INIT()
static Datum HeapTupleGetDatum(const HeapTupleData *tuple)
#define SRF_RETURN_DONE(_funcctx)
#define MAT_SRF_USE_EXPECTED_DESC
Assert(PointerIsAligned(start, uint64))
HeapTuple heap_form_tuple(TupleDesc tupleDescriptor, const Datum *values, const bool *isnull)
#define HeapTupleIsValid(tuple)
static void * GETSTRUCT(const HeapTupleData *tuple)
if(TABLE==NULL||TABLE_index==NULL)
PGDLLIMPORT const ScanKeywordList ScanKeywords
#define UNRESERVED_KEYWORD
#define TYPE_FUNC_NAME_KEYWORD
static const char * GetScanKeyword(int n, const ScanKeywordList *keywords)
void ResetLatch(Latch *latch)
int WaitLatch(Latch *latch, int wakeEvents, long timeout, uint32 wait_event_info)
char * get_database_name(Oid dbid)
void getTypeInputInfo(Oid type, Oid *typInput, Oid *typIOParam)
bool type_is_collatable(Oid typid)
Oid get_base_element_type(Oid typid)
void * MemoryContextAlloc(MemoryContext context, Size size)
void pfree(void *pointer)
MemoryContext CurrentMemoryContext
#define CHECK_FOR_INTERRUPTS()
void namestrcpy(Name name, const char *str)
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
bool parseTypeString(const char *str, Oid *typeid_p, int32 *typmod_p, Node *escontext)
char * get_tablespace_location(Oid tablespaceOid)
FormData_pg_type * Form_pg_type
const char * debug_query_string
static Datum PointerGetDatum(const void *X)
static Datum BoolGetDatum(bool X)
static Datum ObjectIdGetDatum(Oid X)
static Datum CStringGetDatum(const char *X)
static Datum Int32GetDatum(int32 X)
static int fd(const char *x, int i)
char * psprintf(const char *fmt,...)
Oid RelationGetReplicaIndex(Relation relation)
#define TABLESPACE_VERSION_DIRECTORY
int relation_is_updatable(Oid reloid, List *outer_reloids, bool include_triggers, Bitmapset *include_cols)
char * generate_collation_name(Oid collid)
char * downcase_identifier(const char *ident, int len, bool warn, bool truncate)
bool scanner_isspace(char ch)
AttInMetadata * attinmeta
MemoryContext multi_call_memory_ctx
Tuplestorestate * setResult
#define FirstLowInvalidHeapAttributeNumber
void ReleaseSysCache(HeapTuple tuple)
HeapTuple SearchSysCache1(int cacheId, Datum key1)
#define LOG_METAINFO_DATAFILE
void table_close(Relation relation, LOCKMODE lockmode)
Relation table_open(Oid relationId, LOCKMODE lockmode)
void tuplestore_putvalues(Tuplestorestate *state, TupleDesc tdesc, const Datum *values, const bool *isnull)
text * cstring_to_text_with_len(const char *s, int len)
text * cstring_to_text(const char *s)
char * text_to_cstring(const text *t)
#define WL_EXIT_ON_PM_DEATH