2013-02-21 18:26:23 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* postgres_fdw.h
|
|
|
|
* Foreign-data wrapper for remote PostgreSQL servers
|
|
|
|
*
|
2014-01-08 05:05:30 +08:00
|
|
|
* Portions Copyright (c) 2012-2014, PostgreSQL Global Development Group
|
2013-02-21 18:26:23 +08:00
|
|
|
*
|
|
|
|
* IDENTIFICATION
|
|
|
|
* contrib/postgres_fdw/postgres_fdw.h
|
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
#ifndef POSTGRES_FDW_H
|
|
|
|
#define POSTGRES_FDW_H
|
|
|
|
|
|
|
|
#include "foreign/foreign.h"
|
|
|
|
#include "lib/stringinfo.h"
|
|
|
|
#include "nodes/relation.h"
|
|
|
|
#include "utils/rel.h"
|
|
|
|
|
|
|
|
#include "libpq-fe.h"
|
|
|
|
|
2013-03-12 09:31:28 +08:00
|
|
|
/* in postgres_fdw.c */
|
|
|
|
extern int set_transmission_modes(void);
|
|
|
|
extern void reset_transmission_modes(int nestlevel);
|
|
|
|
|
2013-02-21 18:26:23 +08:00
|
|
|
/* in connection.c */
|
2013-03-11 02:14:53 +08:00
|
|
|
extern PGconn *GetConnection(ForeignServer *server, UserMapping *user,
|
|
|
|
bool will_prep_stmt);
|
2013-02-21 18:26:23 +08:00
|
|
|
extern void ReleaseConnection(PGconn *conn);
|
|
|
|
extern unsigned int GetCursorNumber(PGconn *conn);
|
2013-03-11 02:14:53 +08:00
|
|
|
extern unsigned int GetPrepStmtNumber(PGconn *conn);
|
2014-02-04 10:30:02 +08:00
|
|
|
extern void pgfdw_report_error(int elevel, PGresult *res, PGconn *conn,
|
|
|
|
bool clear, const char *sql);
|
2013-02-21 18:26:23 +08:00
|
|
|
|
|
|
|
/* in option.c */
|
|
|
|
extern int ExtractConnectionOptions(List *defelems,
|
|
|
|
const char **keywords,
|
|
|
|
const char **values);
|
|
|
|
|
|
|
|
/* in deparse.c */
|
|
|
|
extern void classifyConditions(PlannerInfo *root,
|
|
|
|
RelOptInfo *baserel,
|
2014-03-08 05:35:58 +08:00
|
|
|
List *input_conds,
|
2013-02-21 18:26:23 +08:00
|
|
|
List **remote_conds,
|
2013-03-22 07:43:59 +08:00
|
|
|
List **local_conds);
|
|
|
|
extern bool is_foreign_expr(PlannerInfo *root,
|
|
|
|
RelOptInfo *baserel,
|
|
|
|
Expr *expr);
|
2013-03-11 02:14:53 +08:00
|
|
|
extern void deparseSelectSql(StringInfo buf,
|
2013-02-21 18:26:23 +08:00
|
|
|
PlannerInfo *root,
|
|
|
|
RelOptInfo *baserel,
|
2013-03-22 12:31:11 +08:00
|
|
|
Bitmapset *attrs_used,
|
|
|
|
List **retrieved_attrs);
|
2013-02-21 18:26:23 +08:00
|
|
|
extern void appendWhereClause(StringInfo buf,
|
2013-03-11 02:14:53 +08:00
|
|
|
PlannerInfo *root,
|
2013-03-22 07:43:59 +08:00
|
|
|
RelOptInfo *baserel,
|
2013-02-21 18:26:23 +08:00
|
|
|
List *exprs,
|
2013-03-22 07:43:59 +08:00
|
|
|
bool is_first,
|
|
|
|
List **params);
|
2013-03-13 06:58:13 +08:00
|
|
|
extern void deparseInsertSql(StringInfo buf, PlannerInfo *root,
|
|
|
|
Index rtindex, Relation rel,
|
2013-03-22 12:31:11 +08:00
|
|
|
List *targetAttrs, List *returningList,
|
|
|
|
List **retrieved_attrs);
|
2013-03-13 06:58:13 +08:00
|
|
|
extern void deparseUpdateSql(StringInfo buf, PlannerInfo *root,
|
|
|
|
Index rtindex, Relation rel,
|
2013-03-22 12:31:11 +08:00
|
|
|
List *targetAttrs, List *returningList,
|
|
|
|
List **retrieved_attrs);
|
2013-03-13 06:58:13 +08:00
|
|
|
extern void deparseDeleteSql(StringInfo buf, PlannerInfo *root,
|
|
|
|
Index rtindex, Relation rel,
|
2013-03-22 12:31:11 +08:00
|
|
|
List *returningList,
|
|
|
|
List **retrieved_attrs);
|
2013-02-22 23:56:06 +08:00
|
|
|
extern void deparseAnalyzeSizeSql(StringInfo buf, Relation rel);
|
2013-03-22 12:31:11 +08:00
|
|
|
extern void deparseAnalyzeSql(StringInfo buf, Relation rel,
|
2013-05-30 04:58:43 +08:00
|
|
|
List **retrieved_attrs);
|
2014-07-11 03:01:31 +08:00
|
|
|
extern void deparseStringLiteral(StringInfo buf, const char *val);
|
2013-02-21 18:26:23 +08:00
|
|
|
|
|
|
|
#endif /* POSTGRES_FDW_H */
|