1 /* contrib/dblink/dblink--1.2.sql */
3 -- complain if script is sourced in psql, rather than via CREATE EXTENSION
4 \echo Use "CREATE EXTENSION dblink" to load this file. \quit
6 -- dblink_connect now restricts non-superusers to password
7 -- authenticated connections
8 CREATE FUNCTION dblink_connect (text)
10 AS 'MODULE_PATHNAME','dblink_connect'
11 LANGUAGE C STRICT PARALLEL RESTRICTED;
13 CREATE FUNCTION dblink_connect (text, text)
15 AS 'MODULE_PATHNAME','dblink_connect'
16 LANGUAGE C STRICT PARALLEL RESTRICTED;
18 -- dblink_connect_u allows non-superusers to use
19 -- non-password authenticated connections, but initially
20 -- privileges are revoked from public
21 CREATE FUNCTION dblink_connect_u (text)
23 AS 'MODULE_PATHNAME','dblink_connect'
24 LANGUAGE C STRICT PARALLEL RESTRICTED SECURITY DEFINER;
26 CREATE FUNCTION dblink_connect_u (text, text)
28 AS 'MODULE_PATHNAME','dblink_connect'
29 LANGUAGE C STRICT PARALLEL RESTRICTED SECURITY DEFINER;
31 REVOKE ALL ON FUNCTION dblink_connect_u (text) FROM public;
32 REVOKE ALL ON FUNCTION dblink_connect_u (text, text) FROM public;
34 CREATE FUNCTION dblink_disconnect ()
36 AS 'MODULE_PATHNAME','dblink_disconnect'
37 LANGUAGE C STRICT PARALLEL RESTRICTED;
39 CREATE FUNCTION dblink_disconnect (text)
41 AS 'MODULE_PATHNAME','dblink_disconnect'
42 LANGUAGE C STRICT PARALLEL RESTRICTED;
44 CREATE FUNCTION dblink_open (text, text)
46 AS 'MODULE_PATHNAME','dblink_open'
47 LANGUAGE C STRICT PARALLEL RESTRICTED;
49 CREATE FUNCTION dblink_open (text, text, boolean)
51 AS 'MODULE_PATHNAME','dblink_open'
52 LANGUAGE C STRICT PARALLEL RESTRICTED;
54 CREATE FUNCTION dblink_open (text, text, text)
56 AS 'MODULE_PATHNAME','dblink_open'
57 LANGUAGE C STRICT PARALLEL RESTRICTED;
59 CREATE FUNCTION dblink_open (text, text, text, boolean)
61 AS 'MODULE_PATHNAME','dblink_open'
62 LANGUAGE C STRICT PARALLEL RESTRICTED;
64 CREATE FUNCTION dblink_fetch (text, int)
66 AS 'MODULE_PATHNAME','dblink_fetch'
67 LANGUAGE C STRICT PARALLEL RESTRICTED;
69 CREATE FUNCTION dblink_fetch (text, int, boolean)
71 AS 'MODULE_PATHNAME','dblink_fetch'
72 LANGUAGE C STRICT PARALLEL RESTRICTED;
74 CREATE FUNCTION dblink_fetch (text, text, int)
76 AS 'MODULE_PATHNAME','dblink_fetch'
77 LANGUAGE C STRICT PARALLEL RESTRICTED;
79 CREATE FUNCTION dblink_fetch (text, text, int, boolean)
81 AS 'MODULE_PATHNAME','dblink_fetch'
82 LANGUAGE C STRICT PARALLEL RESTRICTED;
84 CREATE FUNCTION dblink_close (text)
86 AS 'MODULE_PATHNAME','dblink_close'
87 LANGUAGE C STRICT PARALLEL RESTRICTED;
89 CREATE FUNCTION dblink_close (text, boolean)
91 AS 'MODULE_PATHNAME','dblink_close'
92 LANGUAGE C STRICT PARALLEL RESTRICTED;
94 CREATE FUNCTION dblink_close (text, text)
96 AS 'MODULE_PATHNAME','dblink_close'
97 LANGUAGE C STRICT PARALLEL RESTRICTED;
99 CREATE FUNCTION dblink_close (text, text, boolean)
101 AS 'MODULE_PATHNAME','dblink_close'
102 LANGUAGE C STRICT PARALLEL RESTRICTED;
104 CREATE FUNCTION dblink (text, text)
106 AS 'MODULE_PATHNAME','dblink_record'
107 LANGUAGE C STRICT PARALLEL RESTRICTED;
109 CREATE FUNCTION dblink (text, text, boolean)
111 AS 'MODULE_PATHNAME','dblink_record'
112 LANGUAGE C STRICT PARALLEL RESTRICTED;
114 CREATE FUNCTION dblink (text)
116 AS 'MODULE_PATHNAME','dblink_record'
117 LANGUAGE C STRICT PARALLEL RESTRICTED;
119 CREATE FUNCTION dblink (text, boolean)
121 AS 'MODULE_PATHNAME','dblink_record'
122 LANGUAGE C STRICT PARALLEL RESTRICTED;
124 CREATE FUNCTION dblink_exec (text, text)
126 AS 'MODULE_PATHNAME','dblink_exec'
127 LANGUAGE C STRICT PARALLEL RESTRICTED;
129 CREATE FUNCTION dblink_exec (text, text, boolean)
131 AS 'MODULE_PATHNAME','dblink_exec'
132 LANGUAGE C STRICT PARALLEL RESTRICTED;
134 CREATE FUNCTION dblink_exec (text)
136 AS 'MODULE_PATHNAME','dblink_exec'
137 LANGUAGE C STRICT PARALLEL RESTRICTED;
139 CREATE FUNCTION dblink_exec (text,boolean)
141 AS 'MODULE_PATHNAME','dblink_exec'
142 LANGUAGE C STRICT PARALLEL RESTRICTED;
144 CREATE TYPE dblink_pkey_results AS (position int, colname text);
146 CREATE FUNCTION dblink_get_pkey (text)
147 RETURNS setof dblink_pkey_results
148 AS 'MODULE_PATHNAME','dblink_get_pkey'
149 LANGUAGE C STRICT PARALLEL RESTRICTED;
151 CREATE FUNCTION dblink_build_sql_insert (text, int2vector, int, _text, _text)
153 AS 'MODULE_PATHNAME','dblink_build_sql_insert'
154 LANGUAGE C STRICT PARALLEL RESTRICTED;
156 CREATE FUNCTION dblink_build_sql_delete (text, int2vector, int, _text)
158 AS 'MODULE_PATHNAME','dblink_build_sql_delete'
159 LANGUAGE C STRICT PARALLEL RESTRICTED;
161 CREATE FUNCTION dblink_build_sql_update (text, int2vector, int, _text, _text)
163 AS 'MODULE_PATHNAME','dblink_build_sql_update'
164 LANGUAGE C STRICT PARALLEL RESTRICTED;
166 CREATE FUNCTION dblink_current_query ()
168 AS 'MODULE_PATHNAME','dblink_current_query'
169 LANGUAGE C PARALLEL RESTRICTED;
171 CREATE FUNCTION dblink_send_query(text, text)
173 AS 'MODULE_PATHNAME', 'dblink_send_query'
174 LANGUAGE C STRICT PARALLEL RESTRICTED;
176 CREATE FUNCTION dblink_is_busy(text)
178 AS 'MODULE_PATHNAME', 'dblink_is_busy'
179 LANGUAGE C STRICT PARALLEL RESTRICTED;
181 CREATE FUNCTION dblink_get_result(text)
183 AS 'MODULE_PATHNAME', 'dblink_get_result'
184 LANGUAGE C STRICT PARALLEL RESTRICTED;
186 CREATE FUNCTION dblink_get_result(text, bool)
188 AS 'MODULE_PATHNAME', 'dblink_get_result'
189 LANGUAGE C STRICT PARALLEL RESTRICTED;
191 CREATE FUNCTION dblink_get_connections()
193 AS 'MODULE_PATHNAME', 'dblink_get_connections'
194 LANGUAGE C PARALLEL RESTRICTED;
196 CREATE FUNCTION dblink_cancel_query(text)
198 AS 'MODULE_PATHNAME', 'dblink_cancel_query'
199 LANGUAGE C STRICT PARALLEL RESTRICTED;
201 CREATE FUNCTION dblink_error_message(text)
203 AS 'MODULE_PATHNAME', 'dblink_error_message'
204 LANGUAGE C STRICT PARALLEL RESTRICTED;
206 CREATE FUNCTION dblink_get_notify(
207 OUT notify_name TEXT,
212 AS 'MODULE_PATHNAME', 'dblink_get_notify'
213 LANGUAGE C STRICT PARALLEL RESTRICTED;
215 CREATE FUNCTION dblink_get_notify(
217 OUT notify_name TEXT,
222 AS 'MODULE_PATHNAME', 'dblink_get_notify'
223 LANGUAGE C STRICT PARALLEL RESTRICTED;
225 /* New stuff in 1.1 begins here */
227 CREATE FUNCTION dblink_fdw_validator(
232 AS 'MODULE_PATHNAME', 'dblink_fdw_validator'
233 LANGUAGE C STRICT PARALLEL SAFE;
235 CREATE FOREIGN DATA WRAPPER dblink_fdw VALIDATOR dblink_fdw_validator;