PostgreSQL Source Code git master
|
#include "postgres.h"
#include <sys/file.h>
#include <sys/stat.h>
#include <dirent.h>
#include <fcntl.h>
#include <math.h>
#include <unistd.h>
#include "access/sysattr.h"
#include "access/table.h"
#include "catalog/pg_tablespace.h"
#include "catalog/pg_type.h"
#include "catalog/system_fk_info.h"
#include "commands/dbcommands.h"
#include "commands/tablespace.h"
#include "common/keywords.h"
#include "funcapi.h"
#include "miscadmin.h"
#include "nodes/miscnodes.h"
#include "parser/parse_type.h"
#include "parser/scansup.h"
#include "pgstat.h"
#include "postmaster/syslogger.h"
#include "rewrite/rewriteHandler.h"
#include "storage/fd.h"
#include "storage/latch.h"
#include "tcop/tcopprot.h"
#include "utils/builtins.h"
#include "utils/fmgroids.h"
#include "utils/lsyscache.h"
#include "utils/ruleutils.h"
#include "utils/syscache.h"
#include "utils/timestamp.h"
Go to the source code of this file.
Data Structures | |
struct | ValidIOData |
Macros | |
#define | GetNowFloat() ((float8) GetCurrentTimestamp() / 1000000.0) |
#define | REQ_EVENTS ((1 << CMD_UPDATE) | (1 << CMD_DELETE)) |
Typedefs | |
typedef struct ValidIOData | ValidIOData |
#define GetNowFloat | ( | ) | ((float8) GetCurrentTimestamp() / 1000000.0) |
#define REQ_EVENTS ((1 << CMD_UPDATE) | (1 << CMD_DELETE)) |
typedef struct ValidIOData ValidIOData |
Datum any_value_transfn | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1121 of file misc.c.
References PG_GETARG_DATUM, and PG_RETURN_DATUM.
|
static |
Definition at line 76 of file misc.c.
References ARR_DIMS, ARR_NDIM, ARR_NULLBITMAP, ArrayGetNItems(), Assert, FunctionCallInfoBaseData::flinfo, get_base_element_type(), get_fn_expr_argtype(), get_fn_expr_variadic(), i, nitems, OidIsValid, PG_ARGISNULL, PG_GETARG_ARRAYTYPE_P, and PG_NARGS.
Referenced by pg_num_nonnulls(), and pg_num_nulls().
Datum current_database | ( | PG_FUNCTION_ARGS | ) |
Definition at line 195 of file misc.c.
References get_database_name(), MyDatabaseId, NAMEDATALEN, namestrcpy(), palloc(), and PG_RETURN_NAME.
Referenced by ExecEvalSQLValueFunction().
Datum current_query | ( | PG_FUNCTION_ARGS | ) |
Definition at line 212 of file misc.c.
References cstring_to_text(), debug_query_string, PG_RETURN_NULL, and PG_RETURN_TEXT_P.
Referenced by dblink_current_query().
|
static |
Definition at line 846 of file misc.c.
References is_ident_start().
Referenced by parse_ident().
|
static |
Definition at line 828 of file misc.c.
References IS_HIGHBIT_SET.
Referenced by is_ident_cont(), and parse_ident().
Datum parse_ident | ( | PG_FUNCTION_ARGS | ) |
Definition at line 861 of file misc.c.
References accumArrayResult(), cstring_to_text_with_len(), CStringGetTextDatum, CurrentMemoryContext, downcase_identifier(), ereport, errcode(), errdetail(), errmsg(), ERROR, is_ident_cont(), is_ident_start(), len, makeArrayResult(), PG_GETARG_BOOL, PG_GETARG_TEXT_PP, PG_RETURN_DATUM, PointerGetDatum(), scanner_isspace(), and text_to_cstring().
Datum pg_basetype | ( | PG_FUNCTION_ARGS | ) |
Definition at line 583 of file misc.c.
References GETSTRUCT(), HeapTupleIsValid, ObjectIdGetDatum(), PG_GETARG_OID, PG_RETURN_NULL, PG_RETURN_OID, ReleaseSysCache(), and SearchSysCache1().
Datum pg_collation_for | ( | PG_FUNCTION_ARGS | ) |
Definition at line 619 of file misc.c.
References collid, cstring_to_text(), ereport, errcode(), errmsg(), ERROR, format_type_be(), generate_collation_name(), get_fn_expr_argtype(), PG_GET_COLLATION, PG_RETURN_NULL, PG_RETURN_TEXT_P, and type_is_collatable().
Datum pg_column_is_updatable | ( | PG_FUNCTION_ARGS | ) |
Definition at line 665 of file misc.c.
References attnum, bms_make_singleton(), FirstLowInvalidHeapAttributeNumber, NIL, PG_GETARG_BOOL, PG_GETARG_INT16, PG_GETARG_OID, PG_RETURN_BOOL, relation_is_updatable(), and REQ_EVENTS.
Datum pg_current_logfile | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1000 of file misc.c.
References AllocateFile(), cstring_to_text(), elog, ereport, errcode(), errcode_for_file_access(), errhint(), errmsg(), ERROR, fd(), FreeFile(), LOG_METAINFO_DATAFILE, MAXPGPATH, PG_ARGISNULL, PG_GETARG_TEXT_PP, PG_NARGS, PG_RETURN_NULL, PG_RETURN_TEXT_P, and text_to_cstring().
Referenced by pg_current_logfile_1arg().
Datum pg_current_logfile_1arg | ( | PG_FUNCTION_ARGS | ) |
Datum pg_get_catalog_foreign_keys | ( | PG_FUNCTION_ARGS | ) |
Definition at line 496 of file misc.c.
References BlessTupleDesc(), BoolGetDatum(), FuncCallContext::call_cntr, CStringGetDatum(), elog, ERROR, fmgr_info(), FunctionCall3, get_call_result_type(), heap_form_tuple(), HeapTupleGetDatum(), if(), Int32GetDatum(), lengthof, MemoryContextSwitchTo(), FuncCallContext::multi_call_memory_ctx, ObjectIdGetDatum(), palloc(), SRF_FIRSTCALL_INIT, SRF_IS_FIRSTCALL, SRF_PERCALL_SETUP, SRF_RETURN_DONE, SRF_RETURN_NEXT, FuncCallContext::tuple_desc, TYPEFUNC_COMPOSITE, FuncCallContext::user_fctx, and values.
Datum pg_get_keywords | ( | PG_FUNCTION_ARGS | ) |
Definition at line 418 of file misc.c.
References _, FuncCallContext::attinmeta, BuildTupleFromCStrings(), FuncCallContext::call_cntr, COL_NAME_KEYWORD, elog, ERROR, get_call_result_type(), GetScanKeyword(), HeapTupleGetDatum(), MemoryContextSwitchTo(), FuncCallContext::multi_call_memory_ctx, ScanKeywordList::num_keywords, RESERVED_KEYWORD, ScanKeywordBareLabel, ScanKeywordCategories, ScanKeywords, SRF_FIRSTCALL_INIT, SRF_IS_FIRSTCALL, SRF_PERCALL_SETUP, SRF_RETURN_DONE, SRF_RETURN_NEXT, FuncCallContext::tuple_desc, TupleDescGetAttInMetadata(), TYPE_FUNC_NAME_KEYWORD, TYPEFUNC_COMPOSITE, unconstify, UNRESERVED_KEYWORD, and values.
Datum pg_get_replica_identity_index | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1101 of file misc.c.
References AccessShareLock, OidIsValid, PG_GETARG_OID, PG_RETURN_NULL, PG_RETURN_OID, RelationGetReplicaIndex(), table_close(), and table_open().
Datum pg_input_error_info | ( | PG_FUNCTION_ARGS | ) |
Definition at line 716 of file misc.c.
References Assert, CStringGetTextDatum, ErrorData::detail, ErrorSaveContext::details_wanted, elog, ERROR, ErrorSaveContext::error_data, ErrorSaveContext::error_occurred, get_call_result_type(), heap_form_tuple(), HeapTupleGetDatum(), ErrorData::hint, ErrorData::message, PG_GETARG_TEXT_PP, pg_input_is_valid_common(), ErrorData::sqlerrcode, TYPEFUNC_COMPOSITE, typname, unpack_sql_state(), and values.
Datum pg_input_is_valid | ( | PG_FUNCTION_ARGS | ) |
Definition at line 696 of file misc.c.
References PG_GETARG_TEXT_PP, pg_input_is_valid_common(), PG_RETURN_BOOL, and typname.
|
static |
Definition at line 765 of file misc.c.
References FunctionCallInfoBaseData::flinfo, fmgr_info_cxt(), FmgrInfo::fn_extra, FmgrInfo::fn_mcxt, get_fn_expr_arg_stable(), getTypeInputInfo(), if(), InputFunctionCallSafe(), ValidIOData::inputproc, InvalidOid, MemoryContextAlloc(), parseTypeString(), str, text_to_cstring(), ValidIOData::typiofunc, ValidIOData::typioparam, ValidIOData::typmod, typname, ValidIOData::typname_constant, and ValidIOData::typoid.
Referenced by pg_input_error_info(), and pg_input_is_valid().
Datum pg_num_nonnulls | ( | PG_FUNCTION_ARGS | ) |
Definition at line 178 of file misc.c.
References count_nulls(), PG_RETURN_INT32, and PG_RETURN_NULL.
Datum pg_num_nulls | ( | PG_FUNCTION_ARGS | ) |
Definition at line 162 of file misc.c.
References count_nulls(), PG_RETURN_INT32, and PG_RETURN_NULL.
Datum pg_relation_is_updatable | ( | PG_FUNCTION_ARGS | ) |
Definition at line 648 of file misc.c.
References NIL, PG_GETARG_BOOL, PG_GETARG_OID, PG_RETURN_INT32, and relation_is_updatable().
Datum pg_sleep | ( | PG_FUNCTION_ARGS | ) |
Definition at line 370 of file misc.c.
References CHECK_FOR_INTERRUPTS, GetNowFloat, MyLatch, PG_GETARG_FLOAT8, PG_RETURN_VOID, ResetLatch(), WaitLatch(), WL_EXIT_ON_PM_DEATH, WL_LATCH_SET, and WL_TIMEOUT.
Datum pg_tablespace_databases | ( | PG_FUNCTION_ARGS | ) |
Definition at line 224 of file misc.c.
References AllocateDir(), atooid, directory_is_empty(), ereport, errcode_for_file_access(), errmsg(), ERROR, FreeDir(), InitMaterializedSRF(), MAT_SRF_USE_EXPECTED_DESC, ObjectIdGetDatum(), pfree(), PG_GETARG_OID, PG_TBLSPC_DIR, psprintf(), ReadDir(), ReturnSetInfo::setDesc, ReturnSetInfo::setResult, TABLESPACE_VERSION_DIRECTORY, tuplestore_putvalues(), values, and WARNING.
Datum pg_tablespace_location | ( | PG_FUNCTION_ARGS | ) |
Definition at line 301 of file misc.c.
References cstring_to_text(), ereport, errcode(), errcode_for_file_access(), errmsg(), ERROR, InvalidOid, lstat, MAXPGPATH, MyDatabaseTableSpace, PG_GETARG_OID, PG_RETURN_TEXT_P, PG_TBLSPC_DIR, readlink, S_ISLNK, snprintf, and stat::st_mode.
Datum pg_typeof | ( | PG_FUNCTION_ARGS | ) |
Definition at line 564 of file misc.c.
References get_fn_expr_argtype(), and PG_RETURN_OID.