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 "executor/spi.h"
#include "foreign/foreign.h"
#include "funcapi.h"
#include "lib/stringinfo.h"
#include "libpq-fe.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"
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 | |
PG_MODULE_MAGIC | |
static remoteConn * | pconn = NULL |
static HTAB * | remoteConnHash = NULL |
#define DBLINK_NOTIFY_COLS 3 |
Definition at line 1924 of file dblink.c.
Referenced by dblink_get_notify().
#define NUMCONN 16 |
Definition at line 144 of file dblink.c.
Referenced by createConnHash().
typedef struct remoteConn remoteConn |
typedef struct remoteConnHashEnt remoteConnHashEnt |
|
static |
Definition at line 3063 of file dblink.c.
References Assert, 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 2603 of file dblink.c.
References HASHCTL::entrysize, hash_create(), HASH_ELEM, HASH_STRINGS, HASHCTL::keysize, NAMEDATALEN, and NUMCONN.
Referenced by createNewConnection(), deleteConnection(), and getConnectionByName().
|
static |
Definition at line 2615 of file dblink.c.
References remoteConn::conn, createConnHash(), ereport, errcode(), ERRCODE_DUPLICATE_OBJECT, errmsg(), ERROR, HASH_ENTER, hash_search(), sort-test::key, remoteConnHashEnt::name, pfree(), PQfinish(), pstrdup(), remoteConnHashEnt::rconn, ReleaseExternalFD(), remoteConnHash, strlcpy(), and truncate_identifier().
Referenced by dblink_connect().
Datum dblink_build_sql_delete | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1755 of file dblink.c.
References AccessShareLock, ACL_SELECT, cstring_to_text(), dblink_build_sql_update(), ereport, errcode(), errmsg(), ERROR, get_rel_from_relname(), get_sql_delete(), get_text_array_contents(), PG_FUNCTION_INFO_V1(), PG_GETARG_ARRAYTYPE_P, PG_GETARG_INT32, PG_GETARG_POINTER, PG_GETARG_TEXT_PP, PG_RETURN_TEXT_P, relation_close(), and validate_pkattnums().
Referenced by dblink_build_sql_insert().
Datum dblink_build_sql_insert | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1666 of file dblink.c.
References AccessShareLock, ACL_SELECT, cstring_to_text(), dblink_build_sql_delete(), ereport, errcode(), errmsg(), ERROR, get_rel_from_relname(), get_sql_insert(), get_text_array_contents(), PG_FUNCTION_INFO_V1(), PG_GETARG_ARRAYTYPE_P, PG_GETARG_INT32, PG_GETARG_POINTER, PG_GETARG_TEXT_PP, PG_RETURN_TEXT_P, relation_close(), and validate_pkattnums().
Referenced by dblink_get_pkey().
Datum dblink_build_sql_update | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1831 of file dblink.c.
References AccessShareLock, ACL_SELECT, cstring_to_text(), dblink_current_query(), ereport, errcode(), errmsg(), ERROR, get_rel_from_relname(), get_sql_update(), get_text_array_contents(), PG_FUNCTION_INFO_V1(), PG_GETARG_ARRAYTYPE_P, PG_GETARG_INT32, PG_GETARG_POINTER, PG_GETARG_TEXT_PP, PG_RETURN_TEXT_P, relation_close(), and validate_pkattnums().
Referenced by dblink_build_sql_delete().
Datum dblink_cancel_query | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1383 of file dblink.c.
References remoteConn::conn, cstring_to_text(), dblink_error_message(), dblink_get_named_conn(), dblink_init(), PG_FUNCTION_INFO_V1(), PG_GETARG_TEXT_PP, PG_RETURN_TEXT_P, PQcancel(), PQfreeCancel(), PQgetCancel(), and text_to_cstring().
Referenced by dblink_is_busy().
Datum dblink_close | ( | PG_FUNCTION_ARGS | ) |
Definition at line 517 of file dblink.c.
References appendStringInfo(), buf, remoteConn::conn, cstring_to_text(), StringInfoData::data, dblink_fetch(), dblink_init(), dblink_res_error(), get_fn_expr_argtype(), getConnectionByName(), initStringInfo(), remoteConn::newXactForCursor, remoteConn::openCursorCount, pconn, PG_FUNCTION_INFO_V1(), PG_GETARG_BOOL, PG_GETARG_TEXT_PP, PG_NARGS, PG_RETURN_TEXT_P, PGRES_COMMAND_OK, PQclear(), PQexec(), PQresultStatus(), and text_to_cstring().
Referenced by dblink_open().
Datum dblink_connect | ( | PG_FUNCTION_ARGS | ) |
Definition at line 280 of file dblink.c.
References AcquireExternalFD(), remoteConn::conn, CONNECTION_BAD, connstr, createNewConnection(), cstring_to_text(), dblink_connstr_check(), dblink_disconnect(), dblink_init(), dblink_security_check(), ereport, errcode(), errdetail(), errdetail_internal(), errhint(), errmsg(), ERROR, get_connect_string(), GetDatabaseEncoding(), GetDatabaseEncodingName(), MemoryContextAlloc(), remoteConn::newXactForCursor, remoteConn::openCursorCount, pchomp(), pconn, pfree(), PG_FUNCTION_INFO_V1(), PG_GETARG_TEXT_PP, PG_NARGS, PG_RETURN_TEXT_P, PQclientEncoding(), PQconnectdb(), PQerrorMessage(), PQfinish(), PQsetClientEncoding(), PQstatus(), ReleaseExternalFD(), text_to_cstring(), and TopMemoryContext.
Referenced by dblink_init().
|
static |
Definition at line 2694 of file dblink.c.
References ereport, errcode(), errdetail(), errmsg(), ERROR, _PQconninfoOption::keyword, options, PQconninfoFree(), PQconninfoParse(), superuser(), and _PQconninfoOption::val.
Referenced by dblink_connect(), and dblink_get_conn().
Datum dblink_current_query | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1910 of file dblink.c.
References current_query(), and PG_RETURN_DATUM.
Referenced by dblink_build_sql_update().
Datum dblink_disconnect | ( | PG_FUNCTION_ARGS | ) |
Definition at line 385 of file dblink.c.
References remoteConn::conn, cstring_to_text(), dblink_init(), dblink_open(), deleteConnection(), getConnectionByName(), pconn, pfree(), PG_FUNCTION_INFO_V1(), PG_GETARG_TEXT_PP, PG_NARGS, PG_RETURN_TEXT_P, PQfinish(), ReleaseExternalFD(), and text_to_cstring().
Referenced by dblink_connect().
Datum dblink_error_message | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1416 of file dblink.c.
References remoteConn::conn, cstring_to_text(), dblink_exec(), dblink_get_named_conn(), dblink_init(), pchomp(), PG_FUNCTION_INFO_V1(), PG_GETARG_TEXT_PP, PG_RETURN_TEXT_P, PQerrorMessage(), and text_to_cstring().
Referenced by dblink_cancel_query().
Datum dblink_exec | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1436 of file dblink.c.
References remoteConn::conn, cstring_to_text(), dblink_get_conn(), dblink_get_pkey(), dblink_init(), dblink_res_error(), elog, ereport, errcode(), errmsg(), ERROR, get_fn_expr_argtype(), pconn, PG_END_TRY, PG_FINALLY, PG_FUNCTION_INFO_V1(), PG_GETARG_BOOL, PG_GETARG_TEXT_PP, PG_NARGS, PG_RETURN_TEXT_P, PG_TRY, PGRES_COMMAND_OK, PGRES_TUPLES_OK, PQclear(), PQcmdStatus(), PQexec(), PQfinish(), PQresultStatus(), ReleaseExternalFD(), and text_to_cstring().
Referenced by dblink_error_message().
Datum dblink_fdw_validator | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2006 of file dblink.c.
References appendStringInfo(), buf, StringInfoData::data, DefElem::defname, ereport, errcode(), errdetail(), errhint(), errmsg(), ERROR, initStringInfo(), is_valid_dblink_option(), _PQconninfoOption::keyword, StringInfoData::len, lfirst, PG_GETARG_DATUM, PG_GETARG_OID, PG_RETURN_VOID, PQconndefaults(), and untransformRelOptions().
Referenced by dblink_get_notify().
Datum dblink_fetch | ( | PG_FUNCTION_ARGS | ) |
Definition at line 604 of file dblink.c.
References appendStringInfo(), buf, remoteConn::conn, StringInfoData::data, dblink_init(), dblink_record(), dblink_res_error(), ereport, errcode(), errmsg(), ERROR, get_fn_expr_argtype(), getConnectionByName(), initStringInfo(), materializeResult(), pconn, PG_FUNCTION_INFO_V1(), PG_GETARG_BOOL, PG_GETARG_INT32, PG_GETARG_TEXT_PP, PG_NARGS, PGRES_COMMAND_OK, PGRES_TUPLES_OK, PQclear(), PQexec(), PQresultStatus(), prepTuplestoreResult(), and text_to_cstring().
Referenced by dblink_close().
|
static |
Definition at line 180 of file dblink.c.
References AcquireExternalFD(), remoteConn::conn, CONNECTION_BAD, connstr, dblink_connstr_check(), dblink_security_check(), ereport, errcode(), errdetail(), errdetail_internal(), errhint(), errmsg(), ERROR, get_connect_string(), getConnectionByName(), GetDatabaseEncoding(), GetDatabaseEncodingName(), pchomp(), PQclientEncoding(), PQconnectdb(), PQerrorMessage(), PQfinish(), PQsetClientEncoding(), PQstatus(), and ReleaseExternalFD().
Referenced by dblink_exec(), and dblink_record_internal().
Datum dblink_get_connections | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1324 of file dblink.c.
References accumArrayResult(), CStringGetTextDatum, CurrentMemoryContext, dblink_is_busy(), hash_seq_init(), hash_seq_search(), makeArrayResult(), remoteConnHashEnt::name, PG_FUNCTION_INFO_V1(), PG_RETURN_ARRAYTYPE_P, PG_RETURN_NULL, remoteConnHash, and status().
Referenced by storeRow().
|
static |
Definition at line 252 of file dblink.c.
References remoteConn::conn, 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 1928 of file dblink.c.
References pgNotify::be_pid, remoteConn::conn, CreateTemplateTupleDesc(), CStringGetTextDatum, dblink_fdw_validator(), dblink_get_named_conn(), dblink_init(), DBLINK_NOTIFY_COLS, ReturnSetInfo::econtext, ExprContext::ecxt_per_query_memory, pgNotify::extra, Int32GetDatum, MemoryContextSwitchTo(), pconn, PG_FUNCTION_INFO_V1(), PG_GETARG_TEXT_PP, PG_NARGS, PQconsumeInput(), PQfreemem(), PQnotifies(), prepTuplestoreResult(), pgNotify::relname, ReturnSetInfo::setDesc, ReturnSetInfo::setResult, text_to_cstring(), TupleDescInitEntry(), tuplestore_begin_heap(), tuplestore_donestoring, tuplestore_putvalues(), and work_mem.
Datum dblink_get_pkey | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1542 of file dblink.c.
References AccessShareLock, ACL_SELECT, FuncCallContext::attinmeta, BuildTupleFromCStrings(), FuncCallContext::call_cntr, CreateTemplateTupleDesc(), dblink_build_sql_insert(), get_pkey_attnames(), get_rel_from_relname(), HeapTupleGetDatum, FuncCallContext::max_calls, MemoryContextSwitchTo(), FuncCallContext::multi_call_memory_ctx, palloc(), PG_FUNCTION_INFO_V1(), 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.
Referenced by dblink_exec().
Datum dblink_get_result | ( | PG_FUNCTION_ARGS | ) |
Definition at line 730 of file dblink.c.
References dblink_record_internal().
Referenced by dblink_send_query().
|
static |
Definition at line 264 of file dblink.c.
References remoteConn::conn, dblink_connect(), MemoryContextAlloc(), remoteConn::newXactForCursor, remoteConn::openCursorCount, pconn, PG_FUNCTION_INFO_V1(), and TopMemoryContext.
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 1359 of file dblink.c.
References remoteConn::conn, dblink_cancel_query(), dblink_get_named_conn(), dblink_init(), PG_FUNCTION_INFO_V1(), PG_GETARG_TEXT_PP, PG_RETURN_INT32, PQconsumeInput(), PQisBusy(), and text_to_cstring().
Referenced by dblink_get_connections().
Datum dblink_open | ( | PG_FUNCTION_ARGS | ) |
Definition at line 424 of file dblink.c.
References appendStringInfo(), buf, remoteConn::conn, cstring_to_text(), StringInfoData::data, dblink_close(), dblink_init(), dblink_res_error(), get_fn_expr_argtype(), getConnectionByName(), initStringInfo(), remoteConn::newXactForCursor, remoteConn::openCursorCount, pconn, PG_FUNCTION_INFO_V1(), PG_GETARG_BOOL, PG_GETARG_TEXT_PP, PG_NARGS, PG_RETURN_TEXT_P, PGRES_COMMAND_OK, PQclear(), PQexec(), PQresultStatus(), PQTRANS_IDLE, PQtransactionStatus(), and text_to_cstring().
Referenced by dblink_disconnect().
Datum dblink_record | ( | PG_FUNCTION_ARGS | ) |
Definition at line 698 of file dblink.c.
References dblink_record_internal(), dblink_send_query(), and PG_FUNCTION_INFO_V1().
Referenced by dblink_fetch().
|
static |
Definition at line 736 of file dblink.c.
References remoteConn::conn, dblink_get_conn(), dblink_get_named_conn(), dblink_init(), dblink_res_error(), elog, ERROR, FunctionCallInfoBaseData::flinfo, get_fn_expr_argtype(), 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, PQfinish(), PQgetResult(), PQresultStatus(), prepTuplestoreResult(), ReleaseExternalFD(), and text_to_cstring().
Referenced by dblink_get_result(), and dblink_record().
|
static |
Definition at line 2736 of file dblink.c.
References 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 2667 of file dblink.c.
References ereport, errcode(), errdetail(), errhint(), errmsg(), ERROR, pfree(), PQconnectionUsedPassword(), PQfinish(), ReleaseExternalFD(), and superuser().
Referenced by dblink_connect(), and dblink_get_conn().
Datum dblink_send_query | ( | PG_FUNCTION_ARGS | ) |
Definition at line 705 of file dblink.c.
References remoteConn::conn, dblink_get_named_conn(), dblink_get_result(), elog, ERROR, NOTICE, pchomp(), PG_FUNCTION_INFO_V1(), PG_GETARG_TEXT_PP, PG_NARGS, PG_RETURN_INT32, PQerrorMessage(), PQsendQuery(), and text_to_cstring().
Referenced by dblink_record().
|
static |
Definition at line 2645 of file dblink.c.
References createConnHash(), ereport, errcode(), errmsg(), ERROR, HASH_REMOVE, hash_search(), sort-test::key, pstrdup(), remoteConnHash, and truncate_identifier().
Referenced by dblink_disconnect().
|
static |
Definition at line 2908 of file dblink.c.
References appendStringInfoChar(), buf, StringInfoData::data, and initStringInfo().
Referenced by get_connect_string().
|
static |
Definition at line 2565 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 2412 of file dblink.c.
References i.
Referenced by get_sql_insert(), and get_sql_update().
|
static |
Definition at line 2818 of file dblink.c.
References ACL_USAGE, aclcheck_error(), ACLCHECK_OK, appendStringInfo(), DefElem::arg, buf, StringInfoData::data, DefElem::defname, ereport, errcode(), errdetail(), errmsg(), ERROR, escape_param_str(), ForeignServer::fdwid, GetForeignDataWrapper(), GetForeignServerByName(), GetUserId(), GetUserMapping(), initStringInfo(), is_valid_dblink_option(), lfirst, OBJECT_FOREIGN_SERVER, ForeignDataWrapper::options, ForeignServer::options, UserMapping::options, pg_foreign_server_aclcheck(), PQconndefaults(), pstrdup(), ForeignServer::serverid, ForeignServer::servername, strVal, and truncate_identifier().
Referenced by dblink_connect(), and dblink_get_conn().
Definition at line 2078 of file dblink.c.
References AccessShareLock, BTEqualStrategyNumber, GETSTRUCT, HeapTupleIsValid, i, IndexIndrelidIndexId, ObjectIdGetDatum, palloc(), 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 2540 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 2269 of file dblink.c.
References appendStringInfo(), appendStringInfoString(), buf, StringInfoData::data, 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 2189 of file dblink.c.
References appendStringInfo(), appendStringInfoChar(), appendStringInfoString(), buf, StringInfoData::data, 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 2306 of file dblink.c.
References appendStringInfo(), appendStringInfoString(), buf, StringInfoData::data, 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 2133 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, palloc(), PointerGetDatum, TextDatumGetCString, typalign, and values.
Referenced by dblink_build_sql_delete(), dblink_build_sql_insert(), and dblink_build_sql_update().
|
static |
Definition at line 2427 of file dblink.c.
References appendStringInfo(), appendStringInfoString(), buf, StringInfoData::data, elog, 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 2583 of file dblink.c.
References createConnHash(), HASH_FIND, hash_search(), sort-test::key, 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 3012 of file dblink.c.
References _PQconninfoOption::dispchar, and _PQconninfoOption::keyword.
Referenced by dblink_fdw_validator(), and get_connect_string().
|
static |
Definition at line 1029 of file dblink.c.
References FunctionCallInfoBaseData::resultinfo.
Referenced by dblink_record_internal().
|
static |
Definition at line 887 of file dblink.c.
References applyRemoteGucs(), Assert, BuildTupleFromCStrings(), CreateTemplateTupleDesc(), CreateTupleDescCopy(), ReturnSetInfo::econtext, ExprContext::ecxt_per_query_memory, elog, ereport, errcode(), errmsg(), ERROR, get_call_result_type(), i, MemoryContextSwitchTo(), TupleDescData::natts, palloc(), 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_donestoring, tuplestore_puttuple(), TYPEFUNC_COMPOSITE, TYPEFUNC_RECORD, values, and work_mem.
Referenced by dblink_fetch(), and dblink_record_internal().
|
static |
PG_FUNCTION_INFO_V1 | ( | dblink_connect | ) |
Referenced by dblink_build_sql_delete(), dblink_build_sql_insert(), dblink_build_sql_update(), dblink_cancel_query(), dblink_close(), dblink_connect(), dblink_disconnect(), dblink_error_message(), dblink_exec(), dblink_fetch(), dblink_get_connections(), dblink_get_notify(), dblink_get_pkey(), dblink_init(), dblink_is_busy(), dblink_open(), dblink_record(), dblink_send_query(), and storeRow().
PG_FUNCTION_INFO_V1 | ( | dblink_disconnect | ) |
PG_FUNCTION_INFO_V1 | ( | dblink_open | ) |
PG_FUNCTION_INFO_V1 | ( | dblink_close | ) |
PG_FUNCTION_INFO_V1 | ( | dblink_fetch | ) |
PG_FUNCTION_INFO_V1 | ( | dblink_record | ) |
PG_FUNCTION_INFO_V1 | ( | dblink_send_query | ) |
PG_FUNCTION_INFO_V1 | ( | dblink_get_result | ) |
PG_FUNCTION_INFO_V1 | ( | dblink_get_connections | ) |
PG_FUNCTION_INFO_V1 | ( | dblink_is_busy | ) |
PG_FUNCTION_INFO_V1 | ( | dblink_cancel_query | ) |
PG_FUNCTION_INFO_V1 | ( | dblink_error_message | ) |
PG_FUNCTION_INFO_V1 | ( | dblink_exec | ) |
PG_FUNCTION_INFO_V1 | ( | dblink_get_pkey | ) |
PG_FUNCTION_INFO_V1 | ( | dblink_build_sql_insert | ) |
PG_FUNCTION_INFO_V1 | ( | dblink_build_sql_delete | ) |
PG_FUNCTION_INFO_V1 | ( | dblink_build_sql_update | ) |
PG_FUNCTION_INFO_V1 | ( | dblink_current_query | ) |
PG_FUNCTION_INFO_V1 | ( | dblink_get_notify | ) |
PG_FUNCTION_INFO_V1 | ( | dblink_fdw_validator | ) |
|
static |
Definition at line 859 of file dblink.c.
References ReturnSetInfo::allowedModes, ereport, errcode(), errmsg(), ERROR, IsA, FunctionCallInfoBaseData::resultinfo, ReturnSetInfo::returnMode, ReturnSetInfo::setDesc, ReturnSetInfo::setResult, and SFRM_Materialize.
Referenced by dblink_fetch(), dblink_get_notify(), and dblink_record_internal().
|
static |
Definition at line 2397 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 3115 of file dblink.c.
References AtEOXact_GUC().
Referenced by materializeResult(), and storeQueryResult().
|
static |
Definition at line 1144 of file dblink.c.
References applyRemoteGucs(), CHECK_FOR_INTERRUPTS, storeInfo::cur_res, elog, ERROR, storeInfo::last_res, pchomp(), PGRES_SINGLE_TUPLE, PGRES_TUPLES_OK, PQclear(), PQerrorMessage(), PQgetResult(), PQresultStatus(), PQsendQuery(), PQsetSingleRowMode(), restoreLocalGucs(), and storeRow().
Definition at line 1212 of file dblink.c.
References Assert, storeInfo::attinmeta, BuildTupleFromCStrings(), CreateTupleDescCopy(), storeInfo::cstrs, dblink_get_connections(), ReturnSetInfo::econtext, ExprContext::ecxt_per_query_memory, elog, ereport, errcode(), errmsg(), ERROR, storeInfo::fcinfo, get_call_result_type(), i, MemoryContextReset(), MemoryContextSwitchTo(), TupleDescData::natts, palloc(), pfree(), PG_FUNCTION_INFO_V1(), 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 2941 of file dblink.c.
References int2vector::dim1, ereport, errcode(), errmsg(), ERROR, i, Min, TupleDescData::natts, palloc(), 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 127 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 128 of file dblink.c.
Referenced by createNewConnection(), dblink_get_connections(), deleteConnection(), and getConnectionByName().