PostgreSQL Source Code git master
|
#include "postgres.h"
#include <limits.h>
#include "access/htup_details.h"
#include "access/relation.h"
#include "access/reloptions.h"
#include "access/table.h"
#include "catalog/namespace.h"
#include "catalog/pg_foreign_data_wrapper.h"
#include "catalog/pg_foreign_server.h"
#include "catalog/pg_type.h"
#include "catalog/pg_user_mapping.h"
#include "commands/defrem.h"
#include "common/base64.h"
#include "executor/spi.h"
#include "foreign/foreign.h"
#include "funcapi.h"
#include "lib/stringinfo.h"
#include "libpq-fe.h"
#include "libpq/libpq-be.h"
#include "libpq/libpq-be-fe-helpers.h"
#include "mb/pg_wchar.h"
#include "miscadmin.h"
#include "parser/scansup.h"
#include "utils/acl.h"
#include "utils/builtins.h"
#include "utils/fmgroids.h"
#include "utils/guc.h"
#include "utils/lsyscache.h"
#include "utils/memutils.h"
#include "utils/rel.h"
#include "utils/varlena.h"
#include "utils/wait_event.h"
Go to the source code of this file.
Data Structures | |
struct | remoteConn |
struct | storeInfo |
struct | remoteConnHashEnt |
Macros | |
#define | NUMCONN 16 |
#define | DBLINK_NOTIFY_COLS 3 |
Typedefs | |
typedef struct remoteConn | remoteConn |
typedef struct storeInfo | storeInfo |
typedef struct remoteConnHashEnt | remoteConnHashEnt |
Variables | |
static remoteConn * | pconn = NULL |
static HTAB * | remoteConnHash = NULL |
static uint32 | dblink_we_connect = 0 |
static uint32 | dblink_we_get_conn = 0 |
static uint32 | dblink_we_get_result = 0 |
typedef struct remoteConn remoteConn |
typedef struct remoteConnHashEnt remoteConnHashEnt |
|
static |
Definition at line 3204 of file dblink.c.
References appendStringInfo(), appendStringInfoString(), buf, elog, ERROR, len, MyProcPort, palloc0(), pfree(), pg_b64_enc_len(), pg_b64_encode(), Port::scram_ClientKey, and Port::scram_ServerKey.
Referenced by get_connect_string().
|
static |
Definition at line 3140 of file dblink.c.
References Assert(), conn, GetConfigOption(), GUC_ACTION_SAVE, i, lengthof, NewGUCNestLevel(), PGC_S_SESSION, PGC_USERSET, PQparameterStatus(), and set_config_option().
Referenced by materializeResult(), and storeQueryResult().
|
static |
Definition at line 2549 of file dblink.c.
References ctl, hash_create(), HASH_ELEM, HASH_STRINGS, NAMEDATALEN, and NUMCONN.
Referenced by createNewConnection(), deleteConnection(), and getConnectionByName().
|
static |
Definition at line 2561 of file dblink.c.
References remoteConn::conn, createConnHash(), ereport, errcode(), ERRCODE_DUPLICATE_OBJECT, errmsg(), ERROR, HASH_ENTER, hash_search(), sort-test::key, libpqsrv_disconnect(), name, pfree(), pstrdup(), remoteConnHashEnt::rconn, remoteConnHash, and truncate_identifier().
Referenced by dblink_connect().
Datum dblink_build_sql_delete | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1721 of file dblink.c.
References AccessShareLock, ACL_SELECT, cstring_to_text(), ereport, errcode(), errmsg(), ERROR, get_rel_from_relname(), get_sql_delete(), get_text_array_contents(), PG_GETARG_ARRAYTYPE_P, PG_GETARG_INT32, PG_GETARG_POINTER, PG_GETARG_TEXT_PP, PG_RETURN_TEXT_P, relation_close(), and validate_pkattnums().
Datum dblink_build_sql_insert | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1632 of file dblink.c.
References AccessShareLock, ACL_SELECT, cstring_to_text(), ereport, errcode(), errmsg(), ERROR, get_rel_from_relname(), get_sql_insert(), get_text_array_contents(), PG_GETARG_ARRAYTYPE_P, PG_GETARG_INT32, PG_GETARG_POINTER, PG_GETARG_TEXT_PP, PG_RETURN_TEXT_P, relation_close(), and validate_pkattnums().
Datum dblink_build_sql_update | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1797 of file dblink.c.
References AccessShareLock, ACL_SELECT, cstring_to_text(), ereport, errcode(), errmsg(), ERROR, get_rel_from_relname(), get_sql_update(), get_text_array_contents(), PG_GETARG_ARRAYTYPE_P, PG_GETARG_INT32, PG_GETARG_POINTER, PG_GETARG_TEXT_PP, PG_RETURN_TEXT_P, relation_close(), and validate_pkattnums().
Datum dblink_cancel_query | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1355 of file dblink.c.
References conn, cstring_to_text(), dblink_get_named_conn(), dblink_init(), GetCurrentTimestamp(), libpqsrv_cancel(), PG_GETARG_TEXT_PP, PG_RETURN_TEXT_P, text_to_cstring(), and TimestampTzPlusMilliseconds.
Datum dblink_close | ( | PG_FUNCTION_ARGS | ) |
Definition at line 494 of file dblink.c.
References appendStringInfo(), buf, remoteConn::conn, conn, cstring_to_text(), dblink_conn_not_avail(), dblink_init(), dblink_res_error(), dblink_res_internalerror(), dblink_we_get_result, get_fn_expr_argtype(), getConnectionByName(), initStringInfo(), libpqsrv_exec(), remoteConn::newXactForCursor, remoteConn::openCursorCount, pconn, PG_GETARG_BOOL, PG_GETARG_TEXT_PP, PG_NARGS, PG_RETURN_TEXT_P, PGRES_COMMAND_OK, PQclear(), PQresultStatus(), and text_to_cstring().
|
static |
Definition at line 183 of file dblink.c.
References ereport, errcode(), errmsg(), and ERROR.
Referenced by dblink_close(), dblink_disconnect(), dblink_exec(), dblink_fetch(), dblink_get_named_conn(), dblink_open(), and dblink_record_internal().
Datum dblink_connect | ( | PG_FUNCTION_ARGS | ) |
Definition at line 280 of file dblink.c.
References remoteConn::conn, conn, CONNECTION_BAD, connstr, createNewConnection(), cstring_to_text(), dblink_connstr_check(), dblink_init(), dblink_security_check(), dblink_we_connect, ereport, errcode(), errdetail_internal(), errmsg(), ERROR, get_connect_string(), GetDatabaseEncoding(), GetDatabaseEncodingName(), libpqsrv_connect(), libpqsrv_disconnect(), MemoryContextAlloc(), remoteConn::newXactForCursor, remoteConn::openCursorCount, pchomp(), pconn, pfree(), PG_GETARG_TEXT_PP, PG_NARGS, PG_RETURN_TEXT_P, PQclientEncoding(), PQerrorMessage(), PQsetClientEncoding(), PQstatus(), text_to_cstring(), TopMemoryContext, and WaitEventExtensionNew().
|
static |
Definition at line 2760 of file dblink.c.
References be_gssapi_get_delegation(), connstr, dblink_connstr_has_pw(), dblink_connstr_has_required_scram_options(), ereport, errcode(), errdetail(), errmsg(), ERROR, Port::has_scram_keys, MyProcPort, and superuser().
Referenced by dblink_connect(), and dblink_get_conn().
|
static |
Definition at line 2723 of file dblink.c.
References connstr, options, PQconninfoFree(), PQconninfoParse(), and option::val.
Referenced by dblink_connstr_check(), and dblink_security_check().
|
static |
Definition at line 2620 of file dblink.c.
References connstr, Port::has_scram_keys, MyProcPort, options, PQconninfoFree(), PQconninfoParse(), and option::val.
Referenced by dblink_connstr_check(), and dblink_security_check().
Datum dblink_current_query | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1876 of file dblink.c.
References current_query(), and PG_RETURN_DATUM.
Datum dblink_disconnect | ( | PG_FUNCTION_ARGS | ) |
Definition at line 363 of file dblink.c.
References remoteConn::conn, conn, cstring_to_text(), dblink_conn_not_avail(), dblink_init(), deleteConnection(), getConnectionByName(), libpqsrv_disconnect(), pconn, pfree(), PG_GETARG_TEXT_PP, PG_NARGS, PG_RETURN_TEXT_P, and text_to_cstring().
Datum dblink_error_message | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1385 of file dblink.c.
References conn, cstring_to_text(), dblink_get_named_conn(), dblink_init(), pchomp(), PG_GETARG_TEXT_PP, PG_RETURN_TEXT_P, PQerrorMessage(), and text_to_cstring().
Datum dblink_exec | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1405 of file dblink.c.
References remoteConn::conn, conn, cstring_to_text(), dblink_conn_not_avail(), dblink_get_conn(), dblink_init(), dblink_res_error(), dblink_we_get_result, elog, ereport, errcode(), errmsg(), ERROR, get_fn_expr_argtype(), libpqsrv_disconnect(), libpqsrv_exec(), pconn, PG_END_TRY, PG_FINALLY, PG_GETARG_BOOL, PG_GETARG_TEXT_PP, PG_NARGS, PG_RETURN_TEXT_P, PG_TRY, PGRES_COMMAND_OK, PGRES_TUPLES_OK, PQclear(), PQcmdStatus(), PQresultStatus(), and text_to_cstring().
Datum dblink_fdw_validator | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1947 of file dblink.c.
References DefElem::defname, ereport, errcode(), errdetail(), errhint(), errmsg(), ERROR, getClosestMatch(), initClosestMatch(), is_valid_dblink_fdw_option(), is_valid_dblink_option(), _PQconninfoOption::keyword, lfirst, match_state, PG_GETARG_DATUM, PG_GETARG_OID, PG_RETURN_VOID, PQconndefaults(), untransformRelOptions(), and updateClosestMatch().
Datum dblink_fetch | ( | PG_FUNCTION_ARGS | ) |
Definition at line 581 of file dblink.c.
References appendStringInfo(), buf, remoteConn::conn, conn, dblink_conn_not_avail(), dblink_init(), dblink_res_error(), dblink_we_get_result, ereport, errcode(), errmsg(), ERROR, get_fn_expr_argtype(), getConnectionByName(), initStringInfo(), libpqsrv_exec(), materializeResult(), pconn, PG_GETARG_BOOL, PG_GETARG_INT32, PG_GETARG_TEXT_PP, PG_NARGS, PGRES_COMMAND_OK, PGRES_TUPLES_OK, PQclear(), PQresultStatus(), prepTuplestoreResult(), and text_to_cstring().
|
static |
Definition at line 196 of file dblink.c.
References remoteConn::conn, conn, CONNECTION_BAD, connstr, dblink_connstr_check(), dblink_security_check(), dblink_we_get_conn, ereport, errcode(), errdetail_internal(), errmsg(), ERROR, get_connect_string(), getConnectionByName(), GetDatabaseEncoding(), GetDatabaseEncodingName(), libpqsrv_connect(), libpqsrv_disconnect(), pchomp(), PQclientEncoding(), PQerrorMessage(), PQsetClientEncoding(), PQstatus(), and WaitEventExtensionNew().
Referenced by dblink_exec(), and dblink_record_internal().
Datum dblink_get_connections | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1296 of file dblink.c.
References accumArrayResult(), CStringGetTextDatum, CurrentMemoryContext, hash_seq_init(), hash_seq_search(), makeArrayResult(), remoteConnHashEnt::name, PG_RETURN_DATUM, PG_RETURN_NULL, and remoteConnHash.
|
static |
Definition at line 249 of file dblink.c.
References remoteConn::conn, dblink_conn_not_avail(), and getConnectionByName().
Referenced by dblink_cancel_query(), dblink_error_message(), dblink_get_notify(), dblink_is_busy(), dblink_record_internal(), and dblink_send_query().
Datum dblink_get_notify | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1894 of file dblink.c.
References pgNotify::be_pid, remoteConn::conn, conn, CStringGetTextDatum, dblink_get_named_conn(), dblink_init(), DBLINK_NOTIFY_COLS, pgNotify::extra, InitMaterializedSRF(), Int32GetDatum(), pconn, PG_GETARG_TEXT_PP, PG_NARGS, PQconsumeInput(), PQfreemem(), PQnotifies(), pgNotify::relname, ReturnSetInfo::setDesc, ReturnSetInfo::setResult, text_to_cstring(), tuplestore_putvalues(), and values.
Datum dblink_get_pkey | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1508 of file dblink.c.
References AccessShareLock, ACL_SELECT, FuncCallContext::attinmeta, BuildTupleFromCStrings(), FuncCallContext::call_cntr, CreateTemplateTupleDesc(), get_pkey_attnames(), get_rel_from_relname(), HeapTupleGetDatum(), if(), FuncCallContext::max_calls, MemoryContextSwitchTo(), FuncCallContext::multi_call_memory_ctx, palloc_array, PG_GETARG_TEXT_PP, psprintf(), relation_close(), SRF_FIRSTCALL_INIT, SRF_IS_FIRSTCALL, SRF_PERCALL_SETUP, SRF_RETURN_DONE, SRF_RETURN_NEXT, TupleDescGetAttInMetadata(), TupleDescInitEntry(), FuncCallContext::user_fctx, and values.
Datum dblink_get_result | ( | PG_FUNCTION_ARGS | ) |
Definition at line 707 of file dblink.c.
References dblink_record_internal().
|
static |
Definition at line 261 of file dblink.c.
References remoteConn::conn, dblink_we_get_result, MemoryContextAlloc(), remoteConn::newXactForCursor, remoteConn::openCursorCount, pconn, TopMemoryContext, and WaitEventExtensionNew().
Referenced by dblink_cancel_query(), dblink_close(), dblink_connect(), dblink_disconnect(), dblink_error_message(), dblink_exec(), dblink_fetch(), dblink_get_notify(), dblink_is_busy(), dblink_open(), and dblink_record_internal().
Datum dblink_is_busy | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1331 of file dblink.c.
References conn, dblink_get_named_conn(), dblink_init(), PG_GETARG_TEXT_PP, PG_RETURN_INT32, PQconsumeInput(), PQisBusy(), and text_to_cstring().
Datum dblink_open | ( | PG_FUNCTION_ARGS | ) |
Definition at line 401 of file dblink.c.
References appendStringInfo(), buf, remoteConn::conn, conn, cstring_to_text(), dblink_conn_not_avail(), dblink_init(), dblink_res_error(), dblink_res_internalerror(), dblink_we_get_result, get_fn_expr_argtype(), getConnectionByName(), initStringInfo(), libpqsrv_exec(), remoteConn::newXactForCursor, remoteConn::openCursorCount, pconn, PG_GETARG_BOOL, PG_GETARG_TEXT_PP, PG_NARGS, PG_RETURN_TEXT_P, PGRES_COMMAND_OK, PQclear(), PQresultStatus(), PQTRANS_IDLE, PQtransactionStatus(), and text_to_cstring().
Datum dblink_record | ( | PG_FUNCTION_ARGS | ) |
Definition at line 675 of file dblink.c.
References dblink_record_internal().
|
static |
Definition at line 713 of file dblink.c.
References remoteConn::conn, conn, dblink_conn_not_avail(), dblink_get_conn(), dblink_get_named_conn(), dblink_init(), dblink_res_error(), dblink_we_get_result, elog, ERROR, FunctionCallInfoBaseData::flinfo, get_fn_expr_argtype(), libpqsrv_disconnect(), libpqsrv_get_result(), materializeQueryResult(), materializeResult(), pconn, PG_END_TRY, PG_FINALLY, PG_GETARG_BOOL, PG_GETARG_TEXT_PP, PG_NARGS, PG_TRY, PGRES_COMMAND_OK, PGRES_TUPLES_OK, PQresultStatus(), prepTuplestoreResult(), and text_to_cstring().
Referenced by dblink_get_result(), and dblink_record().
|
static |
Definition at line 2791 of file dblink.c.
References conn, ereport, errcode(), errcontext, errdetail_internal(), errhint(), errmsg(), errmsg_internal(), ERROR, MAKE_SQLSTATE, NOTICE, pchomp(), PG_DIAG_CONTEXT, PG_DIAG_MESSAGE_DETAIL, PG_DIAG_MESSAGE_HINT, PG_DIAG_MESSAGE_PRIMARY, PG_DIAG_SQLSTATE, PQclear(), PQerrorMessage(), PQresultErrorField(), vsnprintf, and xpstrdup().
Referenced by dblink_close(), dblink_exec(), dblink_fetch(), dblink_open(), and dblink_record_internal().
|
static |
Definition at line 174 of file dblink.c.
References conn, elog, ERROR, pchomp(), PQclear(), and PQerrorMessage().
Referenced by dblink_close(), and dblink_open().
|
static |
Definition at line 2676 of file dblink.c.
References be_gssapi_get_delegation(), conn, connstr, dblink_connstr_has_pw(), dblink_connstr_has_required_scram_options(), ereport, errcode(), errdetail(), errhint(), errmsg(), ERROR, Port::has_scram_keys, libpqsrv_disconnect(), MyProcPort, pfree(), PQconnectionUsedGSSAPI(), PQconnectionUsedPassword(), and superuser().
Referenced by dblink_connect(), and dblink_get_conn().
Datum dblink_send_query | ( | PG_FUNCTION_ARGS | ) |
Definition at line 682 of file dblink.c.
References conn, dblink_get_named_conn(), elog, ERROR, NOTICE, pchomp(), PG_GETARG_TEXT_PP, PG_NARGS, PG_RETURN_INT32, PQerrorMessage(), PQsendQuery(), and text_to_cstring().
|
static |
Definition at line 2589 of file dblink.c.
References createConnHash(), ereport, errcode(), errmsg(), ERROR, HASH_REMOVE, hash_search(), sort-test::key, name, pstrdup(), remoteConnHash, and truncate_identifier().
Referenced by dblink_disconnect().
|
static |
Definition at line 2971 of file dblink.c.
References appendStringInfoChar(), buf, initStringInfo(), and str.
Referenced by get_connect_string().
|
static |
Definition at line 2511 of file dblink.c.
References get_namespace_name(), quote_qualified_identifier(), RelationData::rd_rel, RelationGetRelationName, RelationGetRelid, and RelationIsVisible().
Referenced by get_sql_delete(), get_sql_insert(), get_sql_update(), and get_tuple_of_interest().
|
static |
Definition at line 2360 of file dblink.c.
References i, and sort-test::key.
Referenced by get_sql_insert(), and get_sql_update().
|
static |
Definition at line 2873 of file dblink.c.
References ACL_USAGE, aclcheck_error(), ACLCHECK_OK, appendSCRAMKeysInfo(), appendStringInfo(), DefElem::arg, buf, DefElem::defname, ereport, errcode(), errdetail(), errmsg(), ERROR, escape_param_str(), ForeignServer::fdwid, GetForeignDataWrapper(), GetForeignServerByName(), GetUserId(), GetUserMapping(), Port::has_scram_keys, initStringInfo(), is_valid_dblink_option(), lfirst, MyProcPort, object_aclcheck(), OBJECT_FOREIGN_SERVER, ForeignDataWrapper::options, ForeignServer::options, UserMapping::options, PQconndefaults(), pstrdup(), ForeignServer::serverid, ForeignServer::servername, strVal, truncate_identifier(), and UseScramPassthrough().
Referenced by dblink_connect(), and dblink_get_conn().
Definition at line 2026 of file dblink.c.
References AccessShareLock, BTEqualStrategyNumber, GETSTRUCT(), HeapTupleIsValid, i, ObjectIdGetDatum(), palloc_array, RelationData::rd_att, RelationGetRelid, ScanKeyInit(), SPI_fname(), systable_beginscan(), systable_endscan(), systable_getnext(), table_close(), and table_open().
Referenced by dblink_get_pkey().
|
static |
Definition at line 2486 of file dblink.c.
References aclcheck_error(), ACLCHECK_OK, get_relkind_objtype(), GetUserId(), makeRangeVarFromNameList(), pg_class_aclcheck(), RelationData::rd_rel, RelationGetRelationName, RelationGetRelid, table_openrv(), and textToQualifiedNameList().
Referenced by dblink_build_sql_delete(), dblink_build_sql_insert(), dblink_build_sql_update(), and dblink_get_pkey().
|
static |
Definition at line 2217 of file dblink.c.
References appendStringInfo(), appendStringInfoString(), buf, generate_relation_name(), i, initStringInfo(), NameStr, quote_ident_cstr(), quote_literal_cstr(), RelationData::rd_att, relname, and TupleDescAttr().
Referenced by dblink_build_sql_delete().
|
static |
Definition at line 2137 of file dblink.c.
References appendStringInfo(), appendStringInfoChar(), appendStringInfoString(), buf, ereport, errcode(), errmsg(), ERROR, generate_relation_name(), get_attnum_pk_pos(), get_tuple_of_interest(), i, initStringInfo(), sort-test::key, NameStr, TupleDescData::natts, pfree(), pstrdup(), quote_ident_cstr(), quote_literal_cstr(), RelationData::rd_att, relname, SPI_getvalue(), TupleDescAttr(), and val.
Referenced by dblink_build_sql_insert().
|
static |
Definition at line 2254 of file dblink.c.
References appendStringInfo(), appendStringInfoString(), buf, ereport, errcode(), errmsg(), ERROR, generate_relation_name(), get_attnum_pk_pos(), get_tuple_of_interest(), i, initStringInfo(), sort-test::key, NameStr, TupleDescData::natts, pfree(), pstrdup(), quote_ident_cstr(), quote_literal_cstr(), RelationData::rd_att, relname, SPI_getvalue(), TupleDescAttr(), and val.
Referenced by dblink_build_sql_update().
|
static |
Definition at line 2081 of file dblink.c.
References ARR_DATA_PTR, ARR_DIMS, ARR_ELEMTYPE, ARR_NDIM, ARR_NULLBITMAP, ArrayGetNItems(), Assert(), att_addlength_pointer, att_align_nominal, get_typlenbyvalalign(), i, nitems, palloc_array, PointerGetDatum(), TextDatumGetCString, typalign, and values.
Referenced by dblink_build_sql_delete(), dblink_build_sql_insert(), and dblink_build_sql_update().
|
static |
Definition at line 2375 of file dblink.c.
References appendStringInfo(), appendStringInfoString(), buf, ereport, errcode(), errmsg(), ERROR, generate_relation_name(), i, initStringInfo(), NameStr, TupleDescData::natts, pfree(), quote_ident_cstr(), quote_literal_cstr(), RelationData::rd_att, relname, SPI_connect(), SPI_copytuple(), SPI_exec(), SPI_finish(), SPI_OK_SELECT, SPI_processed, SPI_tuptable, TupleDescAttr(), and SPITupleTable::vals.
Referenced by get_sql_insert(), and get_sql_update().
|
static |
Definition at line 2529 of file dblink.c.
References createConnHash(), HASH_FIND, hash_search(), sort-test::key, name, pstrdup(), remoteConnHashEnt::rconn, remoteConnHash, and truncate_identifier().
Referenced by dblink_close(), dblink_disconnect(), dblink_fetch(), dblink_get_conn(), dblink_get_named_conn(), and dblink_open().
|
static |
Definition at line 3120 of file dblink.c.
References is_valid_dblink_option().
Referenced by dblink_fdw_validator().
|
static |
Definition at line 3075 of file dblink.c.
References _PQconninfoOption::dispchar, and _PQconninfoOption::keyword.
Referenced by dblink_fdw_validator(), get_connect_string(), and is_valid_dblink_fdw_option().
|
static |
Definition at line 1000 of file dblink.c.
References FunctionCallInfoBaseData::resultinfo.
Referenced by dblink_record_internal().
|
static |
Definition at line 861 of file dblink.c.
References applyRemoteGucs(), Assert(), BuildTupleFromCStrings(), conn, CreateTemplateTupleDesc(), CreateTupleDescCopy(), ReturnSetInfo::econtext, ExprContext::ecxt_per_query_memory, elog, ereport, errcode(), errmsg(), ERROR, get_call_result_type(), i, MemoryContextSwitchTo(), TupleDescData::natts, palloc_array, PG_END_TRY, PG_FINALLY, PG_TRY, PGRES_COMMAND_OK, PGRES_TUPLES_OK, PQclear(), PQcmdStatus(), PQgetisnull(), PQgetvalue(), PQnfields(), PQntuples(), PQresultStatus(), restoreLocalGucs(), FunctionCallInfoBaseData::resultinfo, ReturnSetInfo::returnMode, ReturnSetInfo::setDesc, ReturnSetInfo::setResult, SFRM_Materialize, TupleDescGetAttInMetadata(), TupleDescInitEntry(), tuplestore_begin_heap(), tuplestore_puttuple(), TYPEFUNC_COMPOSITE, TYPEFUNC_RECORD, values, and work_mem.
Referenced by dblink_fetch(), and dblink_record_internal().
PG_FUNCTION_INFO_V1 | ( | dblink_build_sql_delete | ) |
PG_FUNCTION_INFO_V1 | ( | dblink_build_sql_insert | ) |
PG_FUNCTION_INFO_V1 | ( | dblink_build_sql_update | ) |
PG_FUNCTION_INFO_V1 | ( | dblink_cancel_query | ) |
PG_FUNCTION_INFO_V1 | ( | dblink_close | ) |
PG_FUNCTION_INFO_V1 | ( | dblink_connect | ) |
PG_FUNCTION_INFO_V1 | ( | dblink_current_query | ) |
PG_FUNCTION_INFO_V1 | ( | dblink_disconnect | ) |
PG_FUNCTION_INFO_V1 | ( | dblink_error_message | ) |
PG_FUNCTION_INFO_V1 | ( | dblink_exec | ) |
PG_FUNCTION_INFO_V1 | ( | dblink_fdw_validator | ) |
PG_FUNCTION_INFO_V1 | ( | dblink_fetch | ) |
PG_FUNCTION_INFO_V1 | ( | dblink_get_connections | ) |
PG_FUNCTION_INFO_V1 | ( | dblink_get_notify | ) |
PG_FUNCTION_INFO_V1 | ( | dblink_get_pkey | ) |
PG_FUNCTION_INFO_V1 | ( | dblink_get_result | ) |
PG_FUNCTION_INFO_V1 | ( | dblink_is_busy | ) |
PG_FUNCTION_INFO_V1 | ( | dblink_open | ) |
PG_FUNCTION_INFO_V1 | ( | dblink_record | ) |
PG_FUNCTION_INFO_V1 | ( | dblink_send_query | ) |
PG_MODULE_MAGIC_EXT | ( | . | name = "dblink" , |
. | version = PG_VERSION |
||
) |
|
static |
Definition at line 833 of file dblink.c.
References ReturnSetInfo::allowedModes, ereport, errcode(), errmsg(), ERROR, if(), IsA, FunctionCallInfoBaseData::resultinfo, ReturnSetInfo::returnMode, ReturnSetInfo::setDesc, ReturnSetInfo::setResult, and SFRM_Materialize.
Referenced by dblink_fetch(), and dblink_record_internal().
|
static |
Definition at line 2345 of file dblink.c.
References cstring_to_text(), DatumGetTextPP, DirectFunctionCall1, PointerGetDatum(), quote_ident(), and text_to_cstring().
Referenced by get_sql_delete(), get_sql_insert(), get_sql_update(), and get_tuple_of_interest().
|
static |
Definition at line 3192 of file dblink.c.
References AtEOXact_GUC().
Referenced by materializeResult(), and storeQueryResult().
|
static |
Definition at line 1116 of file dblink.c.
References applyRemoteGucs(), CHECK_FOR_INTERRUPTS, conn, storeInfo::cur_res, dblink_we_get_result, elog, ERROR, storeInfo::last_res, libpqsrv_get_result(), pchomp(), PGRES_SINGLE_TUPLE, PGRES_TUPLES_OK, PQclear(), PQerrorMessage(), PQresultStatus(), PQsendQuery(), PQsetSingleRowMode(), restoreLocalGucs(), and storeRow().
Definition at line 1184 of file dblink.c.
References Assert(), storeInfo::attinmeta, BuildTupleFromCStrings(), CreateTupleDescCopy(), storeInfo::cstrs, ReturnSetInfo::econtext, ExprContext::ecxt_per_query_memory, elog, ereport, errcode(), errmsg(), ERROR, storeInfo::fcinfo, get_call_result_type(), i, if(), MemoryContextReset(), MemoryContextSwitchTo(), TupleDescData::natts, palloc_array, pfree(), PQgetisnull(), PQgetvalue(), PQnfields(), PQntuples(), FunctionCallInfoBaseData::resultinfo, ReturnSetInfo::setDesc, ReturnSetInfo::setResult, storeInfo::tmpcontext, TupleDescGetAttInMetadata(), storeInfo::tuplestore, tuplestore_begin_heap(), tuplestore_end(), tuplestore_puttuple(), TYPEFUNC_COMPOSITE, TYPEFUNC_RECORD, and work_mem.
Referenced by storeQueryResult().
|
static |
Definition at line 3239 of file dblink.c.
References defGetBoolean(), DefElem::defname, lfirst, ForeignServer::options, and user.
Referenced by get_connect_string().
|
static |
Definition at line 3004 of file dblink.c.
References int2vector::dim1, ereport, errcode(), errmsg(), ERROR, i, j, Min, TupleDescData::natts, palloc_array, RelationData::rd_att, TupleDescAttr(), and int2vector::values.
Referenced by dblink_build_sql_delete(), dblink_build_sql_insert(), and dblink_build_sql_update().
|
static |
|
static |
Definition at line 145 of file dblink.c.
Referenced by dblink_connect().
|
static |
Definition at line 146 of file dblink.c.
Referenced by dblink_get_conn().
|
static |
Definition at line 147 of file dblink.c.
Referenced by dblink_close(), dblink_exec(), dblink_fetch(), dblink_init(), dblink_open(), dblink_record_internal(), and storeQueryResult().
|
static |
Definition at line 141 of file dblink.c.
Referenced by dblink_close(), dblink_connect(), dblink_disconnect(), dblink_exec(), dblink_fetch(), dblink_get_notify(), dblink_init(), dblink_open(), and dblink_record_internal().
|
static |
Definition at line 142 of file dblink.c.
Referenced by createNewConnection(), dblink_get_connections(), deleteConnection(), and getConnectionByName().