Fix UNLISTEN to fall out quickly if the current backend has never executed
[PostgreSQL.git] / contrib / dblink / dblink.sql.in
blobab735a8781e7b95980aa87b804ee3fd2680f4cbc
1 /* $PostgreSQL$ */
3 -- Adjust this setting to control where the objects get created.
4 SET search_path = public;
6 -- dblink_connect now restricts non-superusers to password
7 -- authenticated connections
8 CREATE OR REPLACE FUNCTION dblink_connect (text)
9 RETURNS text
10 AS 'MODULE_PATHNAME','dblink_connect'
11 LANGUAGE C STRICT;
13 CREATE OR REPLACE FUNCTION dblink_connect (text, text)
14 RETURNS text
15 AS 'MODULE_PATHNAME','dblink_connect'
16 LANGUAGE C STRICT;
18 -- dblink_connect_u allows non-superusers to use
19 -- non-password authenticated connections, but initially
20 -- privileges are revoked from public
21 CREATE OR REPLACE FUNCTION dblink_connect_u (text)
22 RETURNS text
23 AS 'MODULE_PATHNAME','dblink_connect'
24 LANGUAGE C STRICT SECURITY DEFINER;
26 CREATE OR REPLACE FUNCTION dblink_connect_u (text, text)
27 RETURNS text
28 AS 'MODULE_PATHNAME','dblink_connect'
29 LANGUAGE C STRICT 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 OR REPLACE FUNCTION dblink_disconnect ()
35 RETURNS text
36 AS 'MODULE_PATHNAME','dblink_disconnect'
37 LANGUAGE C STRICT;
39 CREATE OR REPLACE FUNCTION dblink_disconnect (text)
40 RETURNS text
41 AS 'MODULE_PATHNAME','dblink_disconnect'
42 LANGUAGE C STRICT;
44 CREATE OR REPLACE FUNCTION dblink_open (text, text)
45 RETURNS text
46 AS 'MODULE_PATHNAME','dblink_open'
47 LANGUAGE C STRICT;
49 CREATE OR REPLACE FUNCTION dblink_open (text, text, boolean)
50 RETURNS text
51 AS 'MODULE_PATHNAME','dblink_open'
52 LANGUAGE C STRICT;
54 CREATE OR REPLACE FUNCTION dblink_open (text, text, text)
55 RETURNS text
56 AS 'MODULE_PATHNAME','dblink_open'
57 LANGUAGE C STRICT;
59 CREATE OR REPLACE FUNCTION dblink_open (text, text, text, boolean)
60 RETURNS text
61 AS 'MODULE_PATHNAME','dblink_open'
62 LANGUAGE C STRICT;
64 CREATE OR REPLACE FUNCTION dblink_fetch (text, int)
65 RETURNS setof record
66 AS 'MODULE_PATHNAME','dblink_fetch'
67 LANGUAGE C STRICT;
69 CREATE OR REPLACE FUNCTION dblink_fetch (text, int, boolean)
70 RETURNS setof record
71 AS 'MODULE_PATHNAME','dblink_fetch'
72 LANGUAGE C STRICT;
74 CREATE OR REPLACE FUNCTION dblink_fetch (text, text, int)
75 RETURNS setof record
76 AS 'MODULE_PATHNAME','dblink_fetch'
77 LANGUAGE C STRICT;
79 CREATE OR REPLACE FUNCTION dblink_fetch (text, text, int, boolean)
80 RETURNS setof record
81 AS 'MODULE_PATHNAME','dblink_fetch'
82 LANGUAGE C STRICT;
84 CREATE OR REPLACE FUNCTION dblink_close (text)
85 RETURNS text
86 AS 'MODULE_PATHNAME','dblink_close'
87 LANGUAGE C STRICT;
89 CREATE OR REPLACE FUNCTION dblink_close (text, boolean)
90 RETURNS text
91 AS 'MODULE_PATHNAME','dblink_close'
92 LANGUAGE C STRICT;
94 CREATE OR REPLACE FUNCTION dblink_close (text, text)
95 RETURNS text
96 AS 'MODULE_PATHNAME','dblink_close'
97 LANGUAGE C STRICT;
99 CREATE OR REPLACE FUNCTION dblink_close (text, text, boolean)
100 RETURNS text
101 AS 'MODULE_PATHNAME','dblink_close'
102 LANGUAGE C STRICT;
104 CREATE OR REPLACE FUNCTION dblink (text, text)
105 RETURNS setof record
106 AS 'MODULE_PATHNAME','dblink_record'
107 LANGUAGE C STRICT;
109 CREATE OR REPLACE FUNCTION dblink (text, text, boolean)
110 RETURNS setof record
111 AS 'MODULE_PATHNAME','dblink_record'
112 LANGUAGE C STRICT;
114 CREATE OR REPLACE FUNCTION dblink (text)
115 RETURNS setof record
116 AS 'MODULE_PATHNAME','dblink_record'
117 LANGUAGE C STRICT;
119 CREATE OR REPLACE FUNCTION dblink (text, boolean)
120 RETURNS setof record
121 AS 'MODULE_PATHNAME','dblink_record'
122 LANGUAGE C STRICT;
124 CREATE OR REPLACE FUNCTION dblink_exec (text, text)
125 RETURNS text
126 AS 'MODULE_PATHNAME','dblink_exec'
127 LANGUAGE C STRICT;
129 CREATE OR REPLACE FUNCTION dblink_exec (text, text, boolean)
130 RETURNS text
131 AS 'MODULE_PATHNAME','dblink_exec'
132 LANGUAGE C STRICT;
134 CREATE OR REPLACE FUNCTION dblink_exec (text)
135 RETURNS text
136 AS 'MODULE_PATHNAME','dblink_exec'
137 LANGUAGE C STRICT;
139 CREATE OR REPLACE FUNCTION dblink_exec (text,boolean)
140 RETURNS text
141 AS 'MODULE_PATHNAME','dblink_exec'
142 LANGUAGE C STRICT;
144 CREATE TYPE dblink_pkey_results AS (position int, colname text);
146 CREATE OR REPLACE FUNCTION dblink_get_pkey (text)
147 RETURNS setof dblink_pkey_results
148 AS 'MODULE_PATHNAME','dblink_get_pkey'
149 LANGUAGE C STRICT;
151 CREATE OR REPLACE FUNCTION dblink_build_sql_insert (text, int2vector, int, _text, _text)
152 RETURNS text
153 AS 'MODULE_PATHNAME','dblink_build_sql_insert'
154 LANGUAGE C STRICT;
156 CREATE OR REPLACE FUNCTION dblink_build_sql_delete (text, int2vector, int, _text)
157 RETURNS text
158 AS 'MODULE_PATHNAME','dblink_build_sql_delete'
159 LANGUAGE C STRICT;
161 CREATE OR REPLACE FUNCTION dblink_build_sql_update (text, int2vector, int, _text, _text)
162 RETURNS text
163 AS 'MODULE_PATHNAME','dblink_build_sql_update'
164 LANGUAGE C STRICT;
166 CREATE OR REPLACE FUNCTION dblink_current_query ()
167 RETURNS text
168 AS 'SELECT pg_catalog.current_query()'
169 LANGUAGE SQL;
171 CREATE OR REPLACE FUNCTION dblink_send_query(text, text)
172 RETURNS int4
173 AS 'MODULE_PATHNAME', 'dblink_send_query'
174 LANGUAGE C STRICT;
176 CREATE OR REPLACE FUNCTION dblink_is_busy(text)
177 RETURNS int4
178 AS 'MODULE_PATHNAME', 'dblink_is_busy'
179 LANGUAGE C STRICT;
181 CREATE OR REPLACE FUNCTION dblink_get_result(text)
182 RETURNS SETOF record
183 AS 'MODULE_PATHNAME', 'dblink_get_result'
184 LANGUAGE C STRICT;
186 CREATE OR REPLACE FUNCTION dblink_get_result(text, bool)
187 RETURNS SETOF record
188 AS 'MODULE_PATHNAME', 'dblink_get_result'
189 LANGUAGE C STRICT;
191 CREATE OR REPLACE FUNCTION dblink_get_connections()
192 RETURNS text[]
193 AS 'MODULE_PATHNAME', 'dblink_get_connections'
194 LANGUAGE C;
196 CREATE OR REPLACE FUNCTION dblink_cancel_query(text)
197 RETURNS text
198 AS 'MODULE_PATHNAME', 'dblink_cancel_query'
199 LANGUAGE C STRICT;
201 CREATE OR REPLACE FUNCTION dblink_error_message(text)
202 RETURNS text
203 AS 'MODULE_PATHNAME', 'dblink_error_message'
204 LANGUAGE C STRICT;