2008-04-04 20:57:21 +04:00
|
|
|
/* $PostgreSQL: pgsql/contrib/dblink/dblink.sql.in,v 1.15 2008/04/04 16:57:21 momjian Exp $ */
|
2007-11-13 07:24:29 +03:00
|
|
|
|
2007-11-11 06:25:35 +03:00
|
|
|
-- Adjust this setting to control where the objects get created.
|
|
|
|
SET search_path = public;
|
|
|
|
|
2007-07-08 21:12:38 +04:00
|
|
|
-- dblink_connect now restricts non-superusers to password
|
|
|
|
-- authenticated connections
|
2002-10-18 22:41:22 +04:00
|
|
|
CREATE OR REPLACE FUNCTION dblink_connect (text)
|
|
|
|
RETURNS text
|
|
|
|
AS 'MODULE_PATHNAME','dblink_connect'
|
2006-02-27 19:09:50 +03:00
|
|
|
LANGUAGE C STRICT;
|
2002-10-18 22:41:22 +04:00
|
|
|
|
2003-06-25 05:10:15 +04:00
|
|
|
CREATE OR REPLACE FUNCTION dblink_connect (text, text)
|
|
|
|
RETURNS text
|
|
|
|
AS 'MODULE_PATHNAME','dblink_connect'
|
2006-02-27 19:09:50 +03:00
|
|
|
LANGUAGE C STRICT;
|
2003-06-25 05:10:15 +04:00
|
|
|
|
2007-07-08 21:12:38 +04:00
|
|
|
-- dblink_connect_u allows non-superusers to use
|
|
|
|
-- non-password authenticated connections, but initially
|
|
|
|
-- privileges are revoked from public
|
|
|
|
CREATE OR REPLACE FUNCTION dblink_connect_u (text)
|
|
|
|
RETURNS text
|
|
|
|
AS 'MODULE_PATHNAME','dblink_connect'
|
|
|
|
LANGUAGE C STRICT SECURITY DEFINER;
|
|
|
|
|
|
|
|
CREATE OR REPLACE FUNCTION dblink_connect_u (text, text)
|
|
|
|
RETURNS text
|
|
|
|
AS 'MODULE_PATHNAME','dblink_connect'
|
|
|
|
LANGUAGE C STRICT SECURITY DEFINER;
|
|
|
|
|
|
|
|
REVOKE ALL ON FUNCTION dblink_connect_u (text) FROM public;
|
|
|
|
REVOKE ALL ON FUNCTION dblink_connect_u (text, text) FROM public;
|
|
|
|
|
2002-10-18 22:41:22 +04:00
|
|
|
CREATE OR REPLACE FUNCTION dblink_disconnect ()
|
|
|
|
RETURNS text
|
|
|
|
AS 'MODULE_PATHNAME','dblink_disconnect'
|
2006-02-27 19:09:50 +03:00
|
|
|
LANGUAGE C STRICT;
|
2002-10-18 22:41:22 +04:00
|
|
|
|
2003-06-25 05:10:15 +04:00
|
|
|
CREATE OR REPLACE FUNCTION dblink_disconnect (text)
|
|
|
|
RETURNS text
|
|
|
|
AS 'MODULE_PATHNAME','dblink_disconnect'
|
2006-02-27 19:09:50 +03:00
|
|
|
LANGUAGE C STRICT;
|
2003-06-25 05:10:15 +04:00
|
|
|
|
2006-02-27 19:09:50 +03:00
|
|
|
CREATE OR REPLACE FUNCTION dblink_open (text, text)
|
2002-10-18 22:41:22 +04:00
|
|
|
RETURNS text
|
|
|
|
AS 'MODULE_PATHNAME','dblink_open'
|
2006-02-27 19:09:50 +03:00
|
|
|
LANGUAGE C STRICT;
|
2004-03-07 05:27:00 +03:00
|
|
|
|
2006-02-27 19:09:50 +03:00
|
|
|
CREATE OR REPLACE FUNCTION dblink_open (text, text, boolean)
|
2004-03-07 05:27:00 +03:00
|
|
|
RETURNS text
|
|
|
|
AS 'MODULE_PATHNAME','dblink_open'
|
2006-02-27 19:09:50 +03:00
|
|
|
LANGUAGE C STRICT;
|
2002-10-18 22:41:22 +04:00
|
|
|
|
2006-02-27 19:09:50 +03:00
|
|
|
CREATE OR REPLACE FUNCTION dblink_open (text, text, text)
|
2003-06-25 05:10:15 +04:00
|
|
|
RETURNS text
|
|
|
|
AS 'MODULE_PATHNAME','dblink_open'
|
2006-02-27 19:09:50 +03:00
|
|
|
LANGUAGE C STRICT;
|
2004-03-07 05:27:00 +03:00
|
|
|
|
2006-02-27 19:09:50 +03:00
|
|
|
CREATE OR REPLACE FUNCTION dblink_open (text, text, text, boolean)
|
2004-03-07 05:27:00 +03:00
|
|
|
RETURNS text
|
|
|
|
AS 'MODULE_PATHNAME','dblink_open'
|
2006-02-27 19:09:50 +03:00
|
|
|
LANGUAGE C STRICT;
|
2003-06-25 05:10:15 +04:00
|
|
|
|
2006-02-27 19:09:50 +03:00
|
|
|
CREATE OR REPLACE FUNCTION dblink_fetch (text, int)
|
2002-10-18 22:41:22 +04:00
|
|
|
RETURNS setof record
|
|
|
|
AS 'MODULE_PATHNAME','dblink_fetch'
|
2006-02-27 19:09:50 +03:00
|
|
|
LANGUAGE C STRICT;
|
2004-03-07 05:27:00 +03:00
|
|
|
|
2006-02-27 19:09:50 +03:00
|
|
|
CREATE OR REPLACE FUNCTION dblink_fetch (text, int, boolean)
|
2004-03-07 05:27:00 +03:00
|
|
|
RETURNS setof record
|
|
|
|
AS 'MODULE_PATHNAME','dblink_fetch'
|
2006-02-27 19:09:50 +03:00
|
|
|
LANGUAGE C STRICT;
|
2002-10-18 22:41:22 +04:00
|
|
|
|
2006-02-27 19:09:50 +03:00
|
|
|
CREATE OR REPLACE FUNCTION dblink_fetch (text, text, int)
|
2003-06-25 05:10:15 +04:00
|
|
|
RETURNS setof record
|
|
|
|
AS 'MODULE_PATHNAME','dblink_fetch'
|
2006-02-27 19:09:50 +03:00
|
|
|
LANGUAGE C STRICT;
|
2004-03-07 05:27:00 +03:00
|
|
|
|
2006-02-27 19:09:50 +03:00
|
|
|
CREATE OR REPLACE FUNCTION dblink_fetch (text, text, int, boolean)
|
2004-03-07 05:27:00 +03:00
|
|
|
RETURNS setof record
|
|
|
|
AS 'MODULE_PATHNAME','dblink_fetch'
|
2006-02-27 19:09:50 +03:00
|
|
|
LANGUAGE C STRICT;
|
2003-06-25 05:10:15 +04:00
|
|
|
|
2002-10-18 22:41:22 +04:00
|
|
|
CREATE OR REPLACE FUNCTION dblink_close (text)
|
|
|
|
RETURNS text
|
|
|
|
AS 'MODULE_PATHNAME','dblink_close'
|
2006-02-27 19:09:50 +03:00
|
|
|
LANGUAGE C STRICT;
|
2004-03-07 05:27:00 +03:00
|
|
|
|
2006-02-27 19:09:50 +03:00
|
|
|
CREATE OR REPLACE FUNCTION dblink_close (text, boolean)
|
2004-03-07 05:27:00 +03:00
|
|
|
RETURNS text
|
|
|
|
AS 'MODULE_PATHNAME','dblink_close'
|
2006-02-27 19:09:50 +03:00
|
|
|
LANGUAGE C STRICT;
|
2002-09-02 10:13:31 +04:00
|
|
|
|
2006-02-27 19:09:50 +03:00
|
|
|
CREATE OR REPLACE FUNCTION dblink_close (text, text)
|
2003-06-25 05:10:15 +04:00
|
|
|
RETURNS text
|
|
|
|
AS 'MODULE_PATHNAME','dblink_close'
|
2006-02-27 19:09:50 +03:00
|
|
|
LANGUAGE C STRICT;
|
2004-03-07 05:27:00 +03:00
|
|
|
|
2006-02-27 19:09:50 +03:00
|
|
|
CREATE OR REPLACE FUNCTION dblink_close (text, text, boolean)
|
2004-03-07 05:27:00 +03:00
|
|
|
RETURNS text
|
|
|
|
AS 'MODULE_PATHNAME','dblink_close'
|
2006-02-27 19:09:50 +03:00
|
|
|
LANGUAGE C STRICT;
|
2002-09-15 00:28:54 +04:00
|
|
|
|
2006-02-27 19:09:50 +03:00
|
|
|
CREATE OR REPLACE FUNCTION dblink (text, text)
|
2002-10-18 22:41:22 +04:00
|
|
|
RETURNS setof record
|
|
|
|
AS 'MODULE_PATHNAME','dblink_record'
|
2006-02-27 19:09:50 +03:00
|
|
|
LANGUAGE C STRICT;
|
2004-03-07 05:27:00 +03:00
|
|
|
|
2006-02-27 19:09:50 +03:00
|
|
|
CREATE OR REPLACE FUNCTION dblink (text, text, boolean)
|
2004-03-07 05:27:00 +03:00
|
|
|
RETURNS setof record
|
|
|
|
AS 'MODULE_PATHNAME','dblink_record'
|
2006-02-27 19:09:50 +03:00
|
|
|
LANGUAGE C STRICT;
|
2002-10-18 22:41:22 +04:00
|
|
|
|
|
|
|
CREATE OR REPLACE FUNCTION dblink (text)
|
|
|
|
RETURNS setof record
|
|
|
|
AS 'MODULE_PATHNAME','dblink_record'
|
2006-02-27 19:09:50 +03:00
|
|
|
LANGUAGE C STRICT;
|
2004-03-07 05:27:00 +03:00
|
|
|
|
2006-02-27 19:09:50 +03:00
|
|
|
CREATE OR REPLACE FUNCTION dblink (text, boolean)
|
2004-03-07 05:27:00 +03:00
|
|
|
RETURNS setof record
|
|
|
|
AS 'MODULE_PATHNAME','dblink_record'
|
2006-02-27 19:09:50 +03:00
|
|
|
LANGUAGE C STRICT;
|
2002-10-18 22:41:22 +04:00
|
|
|
|
2006-02-27 19:09:50 +03:00
|
|
|
CREATE OR REPLACE FUNCTION dblink_exec (text, text)
|
2002-10-18 22:41:22 +04:00
|
|
|
RETURNS text
|
|
|
|
AS 'MODULE_PATHNAME','dblink_exec'
|
2006-02-27 19:09:50 +03:00
|
|
|
LANGUAGE C STRICT;
|
2004-03-07 05:27:00 +03:00
|
|
|
|
2006-02-27 19:09:50 +03:00
|
|
|
CREATE OR REPLACE FUNCTION dblink_exec (text, text, boolean)
|
2004-03-07 05:27:00 +03:00
|
|
|
RETURNS text
|
|
|
|
AS 'MODULE_PATHNAME','dblink_exec'
|
2006-02-27 19:09:50 +03:00
|
|
|
LANGUAGE C STRICT;
|
2002-10-18 22:41:22 +04:00
|
|
|
|
|
|
|
CREATE OR REPLACE FUNCTION dblink_exec (text)
|
|
|
|
RETURNS text
|
|
|
|
AS 'MODULE_PATHNAME','dblink_exec'
|
2006-02-27 19:09:50 +03:00
|
|
|
LANGUAGE C STRICT;
|
2004-03-07 05:27:00 +03:00
|
|
|
|
2006-02-27 19:09:50 +03:00
|
|
|
CREATE OR REPLACE FUNCTION dblink_exec (text,boolean)
|
2004-03-07 05:27:00 +03:00
|
|
|
RETURNS text
|
|
|
|
AS 'MODULE_PATHNAME','dblink_exec'
|
2006-02-27 19:09:50 +03:00
|
|
|
LANGUAGE C STRICT;
|
2002-04-24 06:28:28 +04:00
|
|
|
|
2006-02-27 19:09:50 +03:00
|
|
|
CREATE TYPE dblink_pkey_results AS (position int, colname text);
|
2002-09-02 10:13:31 +04:00
|
|
|
|
2002-10-18 22:41:22 +04:00
|
|
|
CREATE OR REPLACE FUNCTION dblink_get_pkey (text)
|
|
|
|
RETURNS setof dblink_pkey_results
|
|
|
|
AS 'MODULE_PATHNAME','dblink_get_pkey'
|
2006-02-27 19:09:50 +03:00
|
|
|
LANGUAGE C STRICT;
|
2002-10-18 22:41:22 +04:00
|
|
|
|
2006-02-27 19:09:50 +03:00
|
|
|
CREATE OR REPLACE FUNCTION dblink_build_sql_insert (text, int2vector, int, _text, _text)
|
2002-10-18 22:41:22 +04:00
|
|
|
RETURNS text
|
|
|
|
AS 'MODULE_PATHNAME','dblink_build_sql_insert'
|
2006-02-27 19:09:50 +03:00
|
|
|
LANGUAGE C STRICT;
|
2002-10-18 22:41:22 +04:00
|
|
|
|
2006-02-27 19:09:50 +03:00
|
|
|
CREATE OR REPLACE FUNCTION dblink_build_sql_delete (text, int2vector, int, _text)
|
2002-10-18 22:41:22 +04:00
|
|
|
RETURNS text
|
|
|
|
AS 'MODULE_PATHNAME','dblink_build_sql_delete'
|
2006-02-27 19:09:50 +03:00
|
|
|
LANGUAGE C STRICT;
|
2002-10-18 22:41:22 +04:00
|
|
|
|
2006-02-27 19:09:50 +03:00
|
|
|
CREATE OR REPLACE FUNCTION dblink_build_sql_update (text, int2vector, int, _text, _text)
|
2002-10-18 22:41:22 +04:00
|
|
|
RETURNS text
|
|
|
|
AS 'MODULE_PATHNAME','dblink_build_sql_update'
|
2006-02-27 19:09:50 +03:00
|
|
|
LANGUAGE C STRICT;
|
2002-10-18 22:41:22 +04:00
|
|
|
|
2006-09-03 01:11:15 +04:00
|
|
|
CREATE OR REPLACE FUNCTION dblink_send_query(text, text)
|
|
|
|
RETURNS int4
|
|
|
|
AS 'MODULE_PATHNAME', 'dblink_send_query'
|
|
|
|
LANGUAGE C STRICT;
|
|
|
|
|
|
|
|
CREATE OR REPLACE FUNCTION dblink_is_busy(text)
|
|
|
|
RETURNS int4
|
|
|
|
AS 'MODULE_PATHNAME', 'dblink_is_busy'
|
|
|
|
LANGUAGE C STRICT;
|
|
|
|
|
|
|
|
CREATE OR REPLACE FUNCTION dblink_get_result(text)
|
|
|
|
RETURNS SETOF record
|
|
|
|
AS 'MODULE_PATHNAME', 'dblink_get_result'
|
|
|
|
LANGUAGE C STRICT;
|
|
|
|
|
|
|
|
CREATE OR REPLACE FUNCTION dblink_get_result(text, bool)
|
|
|
|
RETURNS SETOF record
|
|
|
|
AS 'MODULE_PATHNAME', 'dblink_get_result'
|
|
|
|
LANGUAGE C STRICT;
|
|
|
|
|
|
|
|
CREATE OR REPLACE FUNCTION dblink_get_connections()
|
|
|
|
RETURNS text[]
|
|
|
|
AS 'MODULE_PATHNAME', 'dblink_get_connections'
|
|
|
|
LANGUAGE C;
|
|
|
|
|
|
|
|
CREATE OR REPLACE FUNCTION dblink_cancel_query(text)
|
|
|
|
RETURNS text
|
|
|
|
AS 'MODULE_PATHNAME', 'dblink_cancel_query'
|
|
|
|
LANGUAGE C STRICT;
|
|
|
|
|
|
|
|
CREATE OR REPLACE FUNCTION dblink_error_message(text)
|
|
|
|
RETURNS text
|
|
|
|
AS 'MODULE_PATHNAME', 'dblink_error_message'
|
|
|
|
LANGUAGE C STRICT;
|