@ -179,7 +179,7 @@ dblink_conn_not_avail(const char *conname)
static void
dblink_get_conn ( char * conname_or_str ,
PGconn * volatile * conn_p , char * * conname_p , volatile bool * freeconn_p )
PGconn * volatile * conn_p , char * * conname_p , volatile bool * freeconn_p )
{
remoteConn * rconn = getConnectionByName ( conname_or_str ) ;
PGconn * conn ;
@ -207,9 +207,9 @@ dblink_get_conn(char *conname_or_str,
PQfinish ( conn ) ;
ereport ( ERROR ,
( errcode ( ERRCODE_SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION ) ,
errmsg ( " could not establish connection " ) ,
errdetail_internal ( " %s " , msg ) ) ) ;
( errcode ( ERRCODE_SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION ) ,
errmsg ( " could not establish connection " ) ,
errdetail_internal ( " %s " , msg ) ) ) ;
}
dblink_security_check ( conn , rconn ) ;
if ( PQclientEncoding ( conn ) ! = GetDatabaseEncoding ( ) )
@ -869,8 +869,8 @@ materializeResult(FunctionCallInfo fcinfo, PGconn *conn, PGresult *res)
/* failed to determine actual type of RECORD */
ereport ( ERROR ,
( errcode ( ERRCODE_FEATURE_NOT_SUPPORTED ) ,
errmsg ( " function returning record called in context "
" that cannot accept type record " ) ) ) ;
errmsg ( " function returning record called in context "
" that cannot accept type record " ) ) ) ;
break ;
default :
/* result type isn't composite */
@ -909,7 +909,7 @@ materializeResult(FunctionCallInfo fcinfo, PGconn *conn, PGresult *res)
nestlevel = applyRemoteGucs ( conn ) ;
oldcontext = MemoryContextSwitchTo (
rsinfo - > econtext - > ecxt_per_query_memory ) ;
rsinfo - > econtext - > ecxt_per_query_memory ) ;
tupstore = tuplestore_begin_heap ( true , false , work_mem ) ;
rsinfo - > setResult = tupstore ;
rsinfo - > setDesc = tupdesc ;
@ -1036,7 +1036,7 @@ materializeQueryResult(FunctionCallInfo fcinfo,
attinmeta = TupleDescGetAttInMetadata ( tupdesc ) ;
oldcontext = MemoryContextSwitchTo (
rsinfo - > econtext - > ecxt_per_query_memory ) ;
rsinfo - > econtext - > ecxt_per_query_memory ) ;
tupstore = tuplestore_begin_heap ( true , false , work_mem ) ;
rsinfo - > setResult = tupstore ;
rsinfo - > setDesc = tupdesc ;
@ -1460,8 +1460,8 @@ dblink_exec(PG_FUNCTION_ARGS)
{
PQclear ( res ) ;
ereport ( ERROR ,
( errcode ( ERRCODE_S_R_E_PROHIBITED_SQL_STATEMENT_ATTEMPTED ) ,
errmsg ( " statement returning results not allowed " ) ) ) ;
( errcode ( ERRCODE_S_R_E_PROHIBITED_SQL_STATEMENT_ATTEMPTED ) ,
errmsg ( " statement returning results not allowed " ) ) ) ;
}
}
PG_CATCH ( ) ;
@ -1980,7 +1980,7 @@ dblink_fdw_validator(PG_FUNCTION_ARGS)
ereport ( ERROR ,
( errcode ( ERRCODE_FDW_OUT_OF_MEMORY ) ,
errmsg ( " out of memory " ) ,
errdetail ( " could not get libpq's default connection options " ) ) ) ;
errdetail ( " could not get libpq's default connection options " ) ) ) ;
}
/* Validate each supplied option. */
@ -2179,7 +2179,7 @@ get_sql_insert(Relation rel, int *pkattnums, int pknumatts, char **src_pkattvals
appendStringInfoChar ( & buf , ' , ' ) ;
appendStringInfoString ( & buf ,
quote_ident_cstr ( NameStr ( tupdesc - > attrs [ i ] - > attname ) ) ) ;
quote_ident_cstr ( NameStr ( tupdesc - > attrs [ i ] - > attname ) ) ) ;
needComma = true ;
}
@ -2242,7 +2242,7 @@ get_sql_delete(Relation rel, int *pkattnums, int pknumatts, char **tgt_pkattvals
appendStringInfoString ( & buf , " AND " ) ;
appendStringInfoString ( & buf ,
quote_ident_cstr ( NameStr ( tupdesc - > attrs [ pkattnum ] - > attname ) ) ) ;
quote_ident_cstr ( NameStr ( tupdesc - > attrs [ pkattnum ] - > attname ) ) ) ;
if ( tgt_pkattvals [ i ] ! = NULL )
appendStringInfo ( & buf , " = %s " ,
@ -2296,7 +2296,7 @@ get_sql_update(Relation rel, int *pkattnums, int pknumatts, char **src_pkattvals
appendStringInfoString ( & buf , " , " ) ;
appendStringInfo ( & buf , " %s = " ,
quote_ident_cstr ( NameStr ( tupdesc - > attrs [ i ] - > attname ) ) ) ;
quote_ident_cstr ( NameStr ( tupdesc - > attrs [ i ] - > attname ) ) ) ;
key = get_attnum_pk_pos ( pkattnums , pknumatts , i ) ;
@ -2325,7 +2325,7 @@ get_sql_update(Relation rel, int *pkattnums, int pknumatts, char **src_pkattvals
appendStringInfoString ( & buf , " AND " ) ;
appendStringInfoString ( & buf ,
quote_ident_cstr ( NameStr ( tupdesc - > attrs [ pkattnum ] - > attname ) ) ) ;
quote_ident_cstr ( NameStr ( tupdesc - > attrs [ pkattnum ] - > attname ) ) ) ;
val = tgt_pkattvals [ i ] ;
@ -2351,7 +2351,7 @@ quote_ident_cstr(char *rawstr)
rawstr_text = cstring_to_text ( rawstr ) ;
result_text = DatumGetTextPP ( DirectFunctionCall1 ( quote_ident ,
PointerGetDatum ( rawstr_text ) ) ) ;
PointerGetDatum ( rawstr_text ) ) ) ;
result = text_to_cstring ( result_text ) ;
return result ;
@ -2416,7 +2416,7 @@ get_tuple_of_interest(Relation rel, int *pkattnums, int pknumatts, char **src_pk
appendStringInfoString ( & buf , " NULL " ) ;
else
appendStringInfoString ( & buf ,
quote_ident_cstr ( NameStr ( tupdesc - > attrs [ i ] - > attname ) ) ) ;
quote_ident_cstr ( NameStr ( tupdesc - > attrs [ i ] - > attname ) ) ) ;
}
appendStringInfo ( & buf , " FROM %s WHERE " , relname ) ;
@ -2429,7 +2429,7 @@ get_tuple_of_interest(Relation rel, int *pkattnums, int pknumatts, char **src_pk
appendStringInfoString ( & buf , " AND " ) ;
appendStringInfoString ( & buf ,
quote_ident_cstr ( NameStr ( tupdesc - > attrs [ pkattnum ] - > attname ) ) ) ;
quote_ident_cstr ( NameStr ( tupdesc - > attrs [ pkattnum ] - > attname ) ) ) ;
if ( src_pkattvals [ i ] ! = NULL )
appendStringInfo ( & buf , " = %s " ,
@ -2619,10 +2619,10 @@ dblink_security_check(PGconn *conn, remoteConn *rconn)
pfree ( rconn ) ;
ereport ( ERROR ,
( errcode ( ERRCODE_S_R_E_PROHIBITED_SQL_STATEMENT_ATTEMPTED ) ,
errmsg ( " password is required " ) ,
errdetail ( " Non-superuser cannot connect if the server does not request a password. " ) ,
errhint ( " Target server's authentication method must be changed. " ) ) ) ;
( errcode ( ERRCODE_S_R_E_PROHIBITED_SQL_STATEMENT_ATTEMPTED ) ,
errmsg ( " password is required " ) ,
errdetail ( " Non-superuser cannot connect if the server does not request a password. " ) ,
errhint ( " Target server's authentication method must be changed. " ) ) ) ;
}
}
}
@ -2661,9 +2661,9 @@ dblink_connstr_check(const char *connstr)
if ( ! connstr_gives_password )
ereport ( ERROR ,
( errcode ( ERRCODE_S_R_E_PROHIBITED_SQL_STATEMENT_ATTEMPTED ) ,
errmsg ( " password is required " ) ,
errdetail ( " Non-superusers must provide a password in the connection string. " ) ) ) ;
( errcode ( ERRCODE_S_R_E_PROHIBITED_SQL_STATEMENT_ATTEMPTED ) ,
errmsg ( " password is required " ) ,
errdetail ( " Non-superusers must provide a password in the connection string. " ) ) ) ;
}
}
@ -2724,8 +2724,8 @@ dblink_res_error(PGconn *conn, const char *conname, PGresult *res,
message_detail ? errdetail_internal ( " %s " , message_detail ) : 0 ,
message_hint ? errhint ( " %s " , message_hint ) : 0 ,
message_context ? errcontext ( " %s " , message_context ) : 0 ,
errcontext ( " Error occurred on dblink connection named \" %s \" : %s. " ,
dblink_context_conname , dblink_context_msg ) ) ) ;
errcontext ( " Error occurred on dblink connection named \" %s \" : %s. " ,
dblink_context_conname , dblink_context_msg ) ) ) ;
}
/*
@ -2760,7 +2760,7 @@ get_connect_string(const char *servername)
ereport ( ERROR ,
( errcode ( ERRCODE_FDW_OUT_OF_MEMORY ) ,
errmsg ( " out of memory " ) ,
errdetail ( " could not get libpq's default connection options " ) ) ) ;
errdetail ( " could not get libpq's default connection options " ) ) ) ;
}
/* first gather the server connstr options */