1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
|
/* contrib/dblink/dblink--1.2.sql */
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
\echo Use "CREATE EXTENSION dblink" to load this file. \quit
-- dblink_connect now restricts non-superusers to password
-- authenticated connections
CREATE FUNCTION dblink_connect (text)
RETURNS text
AS 'MODULE_PATHNAME','dblink_connect'
LANGUAGE C STRICT PARALLEL RESTRICTED;
CREATE FUNCTION dblink_connect (text, text)
RETURNS text
AS 'MODULE_PATHNAME','dblink_connect'
LANGUAGE C STRICT PARALLEL RESTRICTED;
-- dblink_connect_u allows non-superusers to use
-- non-password authenticated connections, but initially
-- privileges are revoked from public
CREATE FUNCTION dblink_connect_u (text)
RETURNS text
AS 'MODULE_PATHNAME','dblink_connect'
LANGUAGE C STRICT PARALLEL RESTRICTED SECURITY DEFINER;
CREATE FUNCTION dblink_connect_u (text, text)
RETURNS text
AS 'MODULE_PATHNAME','dblink_connect'
LANGUAGE C STRICT PARALLEL RESTRICTED SECURITY DEFINER;
REVOKE ALL ON FUNCTION dblink_connect_u (text) FROM public;
REVOKE ALL ON FUNCTION dblink_connect_u (text, text) FROM public;
CREATE FUNCTION dblink_disconnect ()
RETURNS text
AS 'MODULE_PATHNAME','dblink_disconnect'
LANGUAGE C STRICT PARALLEL RESTRICTED;
CREATE FUNCTION dblink_disconnect (text)
RETURNS text
AS 'MODULE_PATHNAME','dblink_disconnect'
LANGUAGE C STRICT PARALLEL RESTRICTED;
CREATE FUNCTION dblink_open (text, text)
RETURNS text
AS 'MODULE_PATHNAME','dblink_open'
LANGUAGE C STRICT PARALLEL RESTRICTED;
CREATE FUNCTION dblink_open (text, text, boolean)
RETURNS text
AS 'MODULE_PATHNAME','dblink_open'
LANGUAGE C STRICT PARALLEL RESTRICTED;
CREATE FUNCTION dblink_open (text, text, text)
RETURNS text
AS 'MODULE_PATHNAME','dblink_open'
LANGUAGE C STRICT PARALLEL RESTRICTED;
CREATE FUNCTION dblink_open (text, text, text, boolean)
RETURNS text
AS 'MODULE_PATHNAME','dblink_open'
LANGUAGE C STRICT PARALLEL RESTRICTED;
CREATE FUNCTION dblink_fetch (text, int)
RETURNS setof record
AS 'MODULE_PATHNAME','dblink_fetch'
LANGUAGE C STRICT PARALLEL RESTRICTED;
CREATE FUNCTION dblink_fetch (text, int, boolean)
RETURNS setof record
AS 'MODULE_PATHNAME','dblink_fetch'
LANGUAGE C STRICT PARALLEL RESTRICTED;
CREATE FUNCTION dblink_fetch (text, text, int)
RETURNS setof record
AS 'MODULE_PATHNAME','dblink_fetch'
LANGUAGE C STRICT PARALLEL RESTRICTED;
CREATE FUNCTION dblink_fetch (text, text, int, boolean)
RETURNS setof record
AS 'MODULE_PATHNAME','dblink_fetch'
LANGUAGE C STRICT PARALLEL RESTRICTED;
CREATE FUNCTION dblink_close (text)
RETURNS text
AS 'MODULE_PATHNAME','dblink_close'
LANGUAGE C STRICT PARALLEL RESTRICTED;
CREATE FUNCTION dblink_close (text, boolean)
RETURNS text
AS 'MODULE_PATHNAME','dblink_close'
LANGUAGE C STRICT PARALLEL RESTRICTED;
CREATE FUNCTION dblink_close (text, text)
RETURNS text
AS 'MODULE_PATHNAME','dblink_close'
LANGUAGE C STRICT PARALLEL RESTRICTED;
CREATE FUNCTION dblink_close (text, text, boolean)
RETURNS text
AS 'MODULE_PATHNAME','dblink_close'
LANGUAGE C STRICT PARALLEL RESTRICTED;
CREATE FUNCTION dblink (text, text)
RETURNS setof record
AS 'MODULE_PATHNAME','dblink_record'
LANGUAGE C STRICT PARALLEL RESTRICTED;
CREATE FUNCTION dblink (text, text, boolean)
RETURNS setof record
AS 'MODULE_PATHNAME','dblink_record'
LANGUAGE C STRICT PARALLEL RESTRICTED;
CREATE FUNCTION dblink (text)
RETURNS setof record
AS 'MODULE_PATHNAME','dblink_record'
LANGUAGE C STRICT PARALLEL RESTRICTED;
CREATE FUNCTION dblink (text, boolean)
RETURNS setof record
AS 'MODULE_PATHNAME','dblink_record'
LANGUAGE C STRICT PARALLEL RESTRICTED;
CREATE FUNCTION dblink_exec (text, text)
RETURNS text
AS 'MODULE_PATHNAME','dblink_exec'
LANGUAGE C STRICT PARALLEL RESTRICTED;
CREATE FUNCTION dblink_exec (text, text, boolean)
RETURNS text
AS 'MODULE_PATHNAME','dblink_exec'
LANGUAGE C STRICT PARALLEL RESTRICTED;
CREATE FUNCTION dblink_exec (text)
RETURNS text
AS 'MODULE_PATHNAME','dblink_exec'
LANGUAGE C STRICT PARALLEL RESTRICTED;
CREATE FUNCTION dblink_exec (text,boolean)
RETURNS text
AS 'MODULE_PATHNAME','dblink_exec'
LANGUAGE C STRICT PARALLEL RESTRICTED;
CREATE TYPE dblink_pkey_results AS (position int, colname text);
CREATE FUNCTION dblink_get_pkey (text)
RETURNS setof dblink_pkey_results
AS 'MODULE_PATHNAME','dblink_get_pkey'
LANGUAGE C STRICT PARALLEL RESTRICTED;
CREATE FUNCTION dblink_build_sql_insert (text, int2vector, int, _text, _text)
RETURNS text
AS 'MODULE_PATHNAME','dblink_build_sql_insert'
LANGUAGE C STRICT PARALLEL RESTRICTED;
CREATE FUNCTION dblink_build_sql_delete (text, int2vector, int, _text)
RETURNS text
AS 'MODULE_PATHNAME','dblink_build_sql_delete'
LANGUAGE C STRICT PARALLEL RESTRICTED;
CREATE FUNCTION dblink_build_sql_update (text, int2vector, int, _text, _text)
RETURNS text
AS 'MODULE_PATHNAME','dblink_build_sql_update'
LANGUAGE C STRICT PARALLEL RESTRICTED;
CREATE FUNCTION dblink_current_query ()
RETURNS text
AS 'MODULE_PATHNAME','dblink_current_query'
LANGUAGE C PARALLEL RESTRICTED;
CREATE FUNCTION dblink_send_query(text, text)
RETURNS int4
AS 'MODULE_PATHNAME', 'dblink_send_query'
LANGUAGE C STRICT PARALLEL RESTRICTED;
CREATE FUNCTION dblink_is_busy(text)
RETURNS int4
AS 'MODULE_PATHNAME', 'dblink_is_busy'
LANGUAGE C STRICT PARALLEL RESTRICTED;
CREATE FUNCTION dblink_get_result(text)
RETURNS SETOF record
AS 'MODULE_PATHNAME', 'dblink_get_result'
LANGUAGE C STRICT PARALLEL RESTRICTED;
CREATE FUNCTION dblink_get_result(text, bool)
RETURNS SETOF record
AS 'MODULE_PATHNAME', 'dblink_get_result'
LANGUAGE C STRICT PARALLEL RESTRICTED;
CREATE FUNCTION dblink_get_connections()
RETURNS text[]
AS 'MODULE_PATHNAME', 'dblink_get_connections'
LANGUAGE C PARALLEL RESTRICTED;
CREATE FUNCTION dblink_cancel_query(text)
RETURNS text
AS 'MODULE_PATHNAME', 'dblink_cancel_query'
LANGUAGE C STRICT PARALLEL RESTRICTED;
CREATE FUNCTION dblink_error_message(text)
RETURNS text
AS 'MODULE_PATHNAME', 'dblink_error_message'
LANGUAGE C STRICT PARALLEL RESTRICTED;
CREATE FUNCTION dblink_get_notify(
OUT notify_name TEXT,
OUT be_pid INT4,
OUT extra TEXT
)
RETURNS setof record
AS 'MODULE_PATHNAME', 'dblink_get_notify'
LANGUAGE C STRICT PARALLEL RESTRICTED;
CREATE FUNCTION dblink_get_notify(
conname TEXT,
OUT notify_name TEXT,
OUT be_pid INT4,
OUT extra TEXT
)
RETURNS setof record
AS 'MODULE_PATHNAME', 'dblink_get_notify'
LANGUAGE C STRICT PARALLEL RESTRICTED;
/* New stuff in 1.1 begins here */
CREATE FUNCTION dblink_fdw_validator(
options text[],
catalog oid
)
RETURNS void
AS 'MODULE_PATHNAME', 'dblink_fdw_validator'
LANGUAGE C STRICT PARALLEL SAFE;
CREATE FOREIGN DATA WRAPPER dblink_fdw VALIDATOR dblink_fdw_validator;
|