2016-06-18 03:09:57 +08:00
|
|
|
/* contrib/dblink/dblink--1.2.sql */
|
2007-11-11 11:25:35 +08:00
|
|
|
|
2011-10-13 03:45:03 +08:00
|
|
|
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
|
|
|
|
\echo Use "CREATE EXTENSION dblink" to load this file. \quit
|
|
|
|
|
2007-07-09 01:12:38 +08:00
|
|
|
-- dblink_connect now restricts non-superusers to password
|
|
|
|
-- authenticated connections
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION dblink_connect (text)
|
2002-10-19 02:41:22 +08:00
|
|
|
RETURNS text
|
|
|
|
AS 'MODULE_PATHNAME','dblink_connect'
|
2016-06-18 03:09:57 +08:00
|
|
|
LANGUAGE C STRICT PARALLEL RESTRICTED;
|
2002-10-19 02:41:22 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION dblink_connect (text, text)
|
2003-06-25 09:10:15 +08:00
|
|
|
RETURNS text
|
|
|
|
AS 'MODULE_PATHNAME','dblink_connect'
|
2016-06-18 03:09:57 +08:00
|
|
|
LANGUAGE C STRICT PARALLEL RESTRICTED;
|
2003-06-25 09:10:15 +08:00
|
|
|
|
2007-07-09 01:12:38 +08:00
|
|
|
-- dblink_connect_u allows non-superusers to use
|
|
|
|
-- non-password authenticated connections, but initially
|
|
|
|
-- privileges are revoked from public
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION dblink_connect_u (text)
|
2007-07-09 01:12:38 +08:00
|
|
|
RETURNS text
|
|
|
|
AS 'MODULE_PATHNAME','dblink_connect'
|
2016-06-18 03:09:57 +08:00
|
|
|
LANGUAGE C STRICT PARALLEL RESTRICTED SECURITY DEFINER;
|
2007-07-09 01:12:38 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION dblink_connect_u (text, text)
|
2007-07-09 01:12:38 +08:00
|
|
|
RETURNS text
|
|
|
|
AS 'MODULE_PATHNAME','dblink_connect'
|
2016-06-18 03:09:57 +08:00
|
|
|
LANGUAGE C STRICT PARALLEL RESTRICTED SECURITY DEFINER;
|
2007-07-09 01:12:38 +08:00
|
|
|
|
|
|
|
REVOKE ALL ON FUNCTION dblink_connect_u (text) FROM public;
|
|
|
|
REVOKE ALL ON FUNCTION dblink_connect_u (text, text) FROM public;
|
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION dblink_disconnect ()
|
2002-10-19 02:41:22 +08:00
|
|
|
RETURNS text
|
|
|
|
AS 'MODULE_PATHNAME','dblink_disconnect'
|
2016-06-18 03:09:57 +08:00
|
|
|
LANGUAGE C STRICT PARALLEL RESTRICTED;
|
2002-10-19 02:41:22 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION dblink_disconnect (text)
|
2003-06-25 09:10:15 +08:00
|
|
|
RETURNS text
|
|
|
|
AS 'MODULE_PATHNAME','dblink_disconnect'
|
2016-06-18 03:09:57 +08:00
|
|
|
LANGUAGE C STRICT PARALLEL RESTRICTED;
|
2003-06-25 09:10:15 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION dblink_open (text, text)
|
2002-10-19 02:41:22 +08:00
|
|
|
RETURNS text
|
|
|
|
AS 'MODULE_PATHNAME','dblink_open'
|
2016-06-18 03:09:57 +08:00
|
|
|
LANGUAGE C STRICT PARALLEL RESTRICTED;
|
2004-03-07 10:27:00 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION dblink_open (text, text, boolean)
|
2004-03-07 10:27:00 +08:00
|
|
|
RETURNS text
|
|
|
|
AS 'MODULE_PATHNAME','dblink_open'
|
2016-06-18 03:09:57 +08:00
|
|
|
LANGUAGE C STRICT PARALLEL RESTRICTED;
|
2002-10-19 02:41:22 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION dblink_open (text, text, text)
|
2003-06-25 09:10:15 +08:00
|
|
|
RETURNS text
|
|
|
|
AS 'MODULE_PATHNAME','dblink_open'
|
2016-06-18 03:09:57 +08:00
|
|
|
LANGUAGE C STRICT PARALLEL RESTRICTED;
|
2004-03-07 10:27:00 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION dblink_open (text, text, text, boolean)
|
2004-03-07 10:27:00 +08:00
|
|
|
RETURNS text
|
|
|
|
AS 'MODULE_PATHNAME','dblink_open'
|
2016-06-18 03:09:57 +08:00
|
|
|
LANGUAGE C STRICT PARALLEL RESTRICTED;
|
2003-06-25 09:10:15 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION dblink_fetch (text, int)
|
2002-10-19 02:41:22 +08:00
|
|
|
RETURNS setof record
|
|
|
|
AS 'MODULE_PATHNAME','dblink_fetch'
|
2016-06-18 03:09:57 +08:00
|
|
|
LANGUAGE C STRICT PARALLEL RESTRICTED;
|
2004-03-07 10:27:00 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION dblink_fetch (text, int, boolean)
|
2004-03-07 10:27:00 +08:00
|
|
|
RETURNS setof record
|
|
|
|
AS 'MODULE_PATHNAME','dblink_fetch'
|
2016-06-18 03:09:57 +08:00
|
|
|
LANGUAGE C STRICT PARALLEL RESTRICTED;
|
2002-10-19 02:41:22 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION dblink_fetch (text, text, int)
|
2003-06-25 09:10:15 +08:00
|
|
|
RETURNS setof record
|
|
|
|
AS 'MODULE_PATHNAME','dblink_fetch'
|
2016-06-18 03:09:57 +08:00
|
|
|
LANGUAGE C STRICT PARALLEL RESTRICTED;
|
2004-03-07 10:27:00 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION dblink_fetch (text, text, int, boolean)
|
2004-03-07 10:27:00 +08:00
|
|
|
RETURNS setof record
|
|
|
|
AS 'MODULE_PATHNAME','dblink_fetch'
|
2016-06-18 03:09:57 +08:00
|
|
|
LANGUAGE C STRICT PARALLEL RESTRICTED;
|
2003-06-25 09:10:15 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION dblink_close (text)
|
2002-10-19 02:41:22 +08:00
|
|
|
RETURNS text
|
|
|
|
AS 'MODULE_PATHNAME','dblink_close'
|
2016-06-18 03:09:57 +08:00
|
|
|
LANGUAGE C STRICT PARALLEL RESTRICTED;
|
2004-03-07 10:27:00 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION dblink_close (text, boolean)
|
2004-03-07 10:27:00 +08:00
|
|
|
RETURNS text
|
|
|
|
AS 'MODULE_PATHNAME','dblink_close'
|
2016-06-18 03:09:57 +08:00
|
|
|
LANGUAGE C STRICT PARALLEL RESTRICTED;
|
2002-09-02 14:13:31 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION dblink_close (text, text)
|
2003-06-25 09:10:15 +08:00
|
|
|
RETURNS text
|
|
|
|
AS 'MODULE_PATHNAME','dblink_close'
|
2016-06-18 03:09:57 +08:00
|
|
|
LANGUAGE C STRICT PARALLEL RESTRICTED;
|
2004-03-07 10:27:00 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION dblink_close (text, text, boolean)
|
2004-03-07 10:27:00 +08:00
|
|
|
RETURNS text
|
|
|
|
AS 'MODULE_PATHNAME','dblink_close'
|
2016-06-18 03:09:57 +08:00
|
|
|
LANGUAGE C STRICT PARALLEL RESTRICTED;
|
2002-09-15 04:28:54 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION dblink (text, text)
|
2002-10-19 02:41:22 +08:00
|
|
|
RETURNS setof record
|
|
|
|
AS 'MODULE_PATHNAME','dblink_record'
|
2016-06-18 03:09:57 +08:00
|
|
|
LANGUAGE C STRICT PARALLEL RESTRICTED;
|
2004-03-07 10:27:00 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION dblink (text, text, boolean)
|
2004-03-07 10:27:00 +08:00
|
|
|
RETURNS setof record
|
|
|
|
AS 'MODULE_PATHNAME','dblink_record'
|
2016-06-18 03:09:57 +08:00
|
|
|
LANGUAGE C STRICT PARALLEL RESTRICTED;
|
2002-10-19 02:41:22 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION dblink (text)
|
2002-10-19 02:41:22 +08:00
|
|
|
RETURNS setof record
|
|
|
|
AS 'MODULE_PATHNAME','dblink_record'
|
2016-06-18 03:09:57 +08:00
|
|
|
LANGUAGE C STRICT PARALLEL RESTRICTED;
|
2004-03-07 10:27:00 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION dblink (text, boolean)
|
2004-03-07 10:27:00 +08:00
|
|
|
RETURNS setof record
|
|
|
|
AS 'MODULE_PATHNAME','dblink_record'
|
2016-06-18 03:09:57 +08:00
|
|
|
LANGUAGE C STRICT PARALLEL RESTRICTED;
|
2002-10-19 02:41:22 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION dblink_exec (text, text)
|
2002-10-19 02:41:22 +08:00
|
|
|
RETURNS text
|
|
|
|
AS 'MODULE_PATHNAME','dblink_exec'
|
2016-06-18 03:09:57 +08:00
|
|
|
LANGUAGE C STRICT PARALLEL RESTRICTED;
|
2004-03-07 10:27:00 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION dblink_exec (text, text, boolean)
|
2004-03-07 10:27:00 +08:00
|
|
|
RETURNS text
|
|
|
|
AS 'MODULE_PATHNAME','dblink_exec'
|
2016-06-18 03:09:57 +08:00
|
|
|
LANGUAGE C STRICT PARALLEL RESTRICTED;
|
2002-10-19 02:41:22 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION dblink_exec (text)
|
2002-10-19 02:41:22 +08:00
|
|
|
RETURNS text
|
|
|
|
AS 'MODULE_PATHNAME','dblink_exec'
|
2016-06-18 03:09:57 +08:00
|
|
|
LANGUAGE C STRICT PARALLEL RESTRICTED;
|
2004-03-07 10:27:00 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION dblink_exec (text,boolean)
|
2004-03-07 10:27:00 +08:00
|
|
|
RETURNS text
|
|
|
|
AS 'MODULE_PATHNAME','dblink_exec'
|
2016-06-18 03:09:57 +08:00
|
|
|
LANGUAGE C STRICT PARALLEL RESTRICTED;
|
2002-04-24 10:28:28 +08:00
|
|
|
|
2006-02-28 00:09:50 +08:00
|
|
|
CREATE TYPE dblink_pkey_results AS (position int, colname text);
|
2002-09-02 14:13:31 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION dblink_get_pkey (text)
|
2002-10-19 02:41:22 +08:00
|
|
|
RETURNS setof dblink_pkey_results
|
|
|
|
AS 'MODULE_PATHNAME','dblink_get_pkey'
|
2016-06-18 03:09:57 +08:00
|
|
|
LANGUAGE C STRICT PARALLEL RESTRICTED;
|
2002-10-19 02:41:22 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION dblink_build_sql_insert (text, int2vector, int, _text, _text)
|
2002-10-19 02:41:22 +08:00
|
|
|
RETURNS text
|
|
|
|
AS 'MODULE_PATHNAME','dblink_build_sql_insert'
|
2016-06-18 03:09:57 +08:00
|
|
|
LANGUAGE C STRICT PARALLEL SAFE;
|
2002-10-19 02:41:22 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION dblink_build_sql_delete (text, int2vector, int, _text)
|
2002-10-19 02:41:22 +08:00
|
|
|
RETURNS text
|
|
|
|
AS 'MODULE_PATHNAME','dblink_build_sql_delete'
|
2016-06-18 03:09:57 +08:00
|
|
|
LANGUAGE C STRICT PARALLEL SAFE;
|
2002-10-19 02:41:22 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION dblink_build_sql_update (text, int2vector, int, _text, _text)
|
2002-10-19 02:41:22 +08:00
|
|
|
RETURNS text
|
|
|
|
AS 'MODULE_PATHNAME','dblink_build_sql_update'
|
2016-06-18 03:09:57 +08:00
|
|
|
LANGUAGE C STRICT PARALLEL SAFE;
|
2002-10-19 02:41:22 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION dblink_current_query ()
|
2008-04-05 10:26:14 +08:00
|
|
|
RETURNS text
|
2009-06-10 01:41:02 +08:00
|
|
|
AS 'MODULE_PATHNAME','dblink_current_query'
|
2016-06-18 03:09:57 +08:00
|
|
|
LANGUAGE C PARALLEL RESTRICTED;
|
2008-04-05 10:26:14 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION dblink_send_query(text, text)
|
2006-09-03 05:11:15 +08:00
|
|
|
RETURNS int4
|
|
|
|
AS 'MODULE_PATHNAME', 'dblink_send_query'
|
2016-06-18 03:09:57 +08:00
|
|
|
LANGUAGE C STRICT PARALLEL RESTRICTED;
|
2006-09-03 05:11:15 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION dblink_is_busy(text)
|
2006-09-03 05:11:15 +08:00
|
|
|
RETURNS int4
|
|
|
|
AS 'MODULE_PATHNAME', 'dblink_is_busy'
|
2016-06-18 03:09:57 +08:00
|
|
|
LANGUAGE C STRICT PARALLEL RESTRICTED;
|
2006-09-03 05:11:15 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION dblink_get_result(text)
|
2006-09-03 05:11:15 +08:00
|
|
|
RETURNS SETOF record
|
|
|
|
AS 'MODULE_PATHNAME', 'dblink_get_result'
|
2016-06-18 03:09:57 +08:00
|
|
|
LANGUAGE C STRICT PARALLEL RESTRICTED;
|
2006-09-03 05:11:15 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION dblink_get_result(text, bool)
|
2006-09-03 05:11:15 +08:00
|
|
|
RETURNS SETOF record
|
|
|
|
AS 'MODULE_PATHNAME', 'dblink_get_result'
|
2016-06-18 03:09:57 +08:00
|
|
|
LANGUAGE C STRICT PARALLEL RESTRICTED;
|
2006-09-03 05:11:15 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION dblink_get_connections()
|
2006-09-03 05:11:15 +08:00
|
|
|
RETURNS text[]
|
|
|
|
AS 'MODULE_PATHNAME', 'dblink_get_connections'
|
2016-06-18 03:09:57 +08:00
|
|
|
LANGUAGE C PARALLEL RESTRICTED;
|
2006-09-03 05:11:15 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION dblink_cancel_query(text)
|
2006-09-03 05:11:15 +08:00
|
|
|
RETURNS text
|
|
|
|
AS 'MODULE_PATHNAME', 'dblink_cancel_query'
|
2016-06-18 03:09:57 +08:00
|
|
|
LANGUAGE C STRICT PARALLEL RESTRICTED;
|
2006-09-03 05:11:15 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION dblink_error_message(text)
|
2006-09-03 05:11:15 +08:00
|
|
|
RETURNS text
|
|
|
|
AS 'MODULE_PATHNAME', 'dblink_error_message'
|
2016-06-18 03:09:57 +08:00
|
|
|
LANGUAGE C STRICT PARALLEL RESTRICTED;
|
2009-08-06 00:11:07 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION dblink_get_notify(
|
2009-08-06 00:11:07 +08:00
|
|
|
OUT notify_name TEXT,
|
|
|
|
OUT be_pid INT4,
|
|
|
|
OUT extra TEXT
|
2010-11-24 04:27:50 +08:00
|
|
|
)
|
2009-08-06 00:11:07 +08:00
|
|
|
RETURNS setof record
|
|
|
|
AS 'MODULE_PATHNAME', 'dblink_get_notify'
|
2016-06-18 03:09:57 +08:00
|
|
|
LANGUAGE C STRICT PARALLEL RESTRICTED;
|
2009-08-06 00:11:07 +08:00
|
|
|
|
2011-02-14 10:24:14 +08:00
|
|
|
CREATE FUNCTION dblink_get_notify(
|
2009-08-06 00:11:07 +08:00
|
|
|
conname TEXT,
|
|
|
|
OUT notify_name TEXT,
|
|
|
|
OUT be_pid INT4,
|
|
|
|
OUT extra TEXT
|
2010-11-24 04:27:50 +08:00
|
|
|
)
|
2009-08-06 00:11:07 +08:00
|
|
|
RETURNS setof record
|
|
|
|
AS 'MODULE_PATHNAME', 'dblink_get_notify'
|
2016-06-18 03:09:57 +08:00
|
|
|
LANGUAGE C STRICT PARALLEL RESTRICTED;
|
2012-10-11 04:53:08 +08:00
|
|
|
|
|
|
|
/* New stuff in 1.1 begins here */
|
|
|
|
|
|
|
|
CREATE FUNCTION dblink_fdw_validator(
|
|
|
|
options text[],
|
|
|
|
catalog oid
|
|
|
|
)
|
|
|
|
RETURNS void
|
|
|
|
AS 'MODULE_PATHNAME', 'dblink_fdw_validator'
|
2016-06-18 03:09:57 +08:00
|
|
|
LANGUAGE C STRICT PARALLEL SAFE;
|
2012-10-11 04:53:08 +08:00
|
|
|
|
|
|
|
CREATE FOREIGN DATA WRAPPER dblink_fdw VALIDATOR dblink_fdw_validator;
|