mirror of
https://github.com/postgres/postgres.git
synced 2025-07-31 22:04:40 +03:00
Implement current_query(), that shows the currently executing query.
At the same time remove dblink/dblink_current_query() as it is no longer necessary *BACKWARD COMPATIBILITY ISSUE* for dblink Tomas Doran
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
* Darko Prenosil <Darko.Prenosil@finteh.hr>
|
||||
* Shridhar Daithankar <shridhar_daithankar@persistent.co.in>
|
||||
*
|
||||
* $PostgreSQL: pgsql/contrib/dblink/dblink.c,v 1.71 2008/03/26 21:10:36 alvherre Exp $
|
||||
* $PostgreSQL: pgsql/contrib/dblink/dblink.c,v 1.72 2008/04/04 16:57:21 momjian Exp $
|
||||
* Copyright (c) 2001-2008, PostgreSQL Global Development Group
|
||||
* ALL RIGHTS RESERVED;
|
||||
*
|
||||
@ -1631,23 +1631,6 @@ dblink_build_sql_update(PG_FUNCTION_ARGS)
|
||||
PG_RETURN_TEXT_P(cstring_to_text(sql));
|
||||
}
|
||||
|
||||
/*
|
||||
* dblink_current_query
|
||||
* return the current query string
|
||||
* to allow its use in (among other things)
|
||||
* rewrite rules
|
||||
*/
|
||||
PG_FUNCTION_INFO_V1(dblink_current_query);
|
||||
Datum
|
||||
dblink_current_query(PG_FUNCTION_ARGS)
|
||||
{
|
||||
if (debug_query_string)
|
||||
PG_RETURN_TEXT_P(cstring_to_text(debug_query_string));
|
||||
else
|
||||
PG_RETURN_NULL();
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************
|
||||
* internal functions
|
||||
*/
|
||||
|
@ -8,7 +8,7 @@
|
||||
* Darko Prenosil <Darko.Prenosil@finteh.hr>
|
||||
* Shridhar Daithankar <shridhar_daithankar@persistent.co.in>
|
||||
*
|
||||
* $PostgreSQL: pgsql/contrib/dblink/dblink.h,v 1.19 2008/01/01 19:45:45 momjian Exp $
|
||||
* $PostgreSQL: pgsql/contrib/dblink/dblink.h,v 1.20 2008/04/04 16:57:21 momjian Exp $
|
||||
* Copyright (c) 2001-2008, PostgreSQL Global Development Group
|
||||
* ALL RIGHTS RESERVED;
|
||||
*
|
||||
@ -56,6 +56,5 @@ extern Datum dblink_get_pkey(PG_FUNCTION_ARGS);
|
||||
extern Datum dblink_build_sql_insert(PG_FUNCTION_ARGS);
|
||||
extern Datum dblink_build_sql_delete(PG_FUNCTION_ARGS);
|
||||
extern Datum dblink_build_sql_update(PG_FUNCTION_ARGS);
|
||||
extern Datum dblink_current_query(PG_FUNCTION_ARGS);
|
||||
|
||||
#endif /* DBLINK_H */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $PostgreSQL: pgsql/contrib/dblink/dblink.sql.in,v 1.14 2007/11/13 04:24:27 momjian Exp $ */
|
||||
/* $PostgreSQL: pgsql/contrib/dblink/dblink.sql.in,v 1.15 2008/04/04 16:57:21 momjian Exp $ */
|
||||
|
||||
-- Adjust this setting to control where the objects get created.
|
||||
SET search_path = public;
|
||||
@ -163,11 +163,6 @@ RETURNS text
|
||||
AS 'MODULE_PATHNAME','dblink_build_sql_update'
|
||||
LANGUAGE C STRICT;
|
||||
|
||||
CREATE OR REPLACE FUNCTION dblink_current_query ()
|
||||
RETURNS text
|
||||
AS 'MODULE_PATHNAME','dblink_current_query'
|
||||
LANGUAGE C;
|
||||
|
||||
CREATE OR REPLACE FUNCTION dblink_send_query(text, text)
|
||||
RETURNS int4
|
||||
AS 'MODULE_PATHNAME', 'dblink_send_query'
|
||||
|
@ -22,13 +22,6 @@ INSERT INTO foo VALUES (7,'h','{"a7","b7","c7"}');
|
||||
INSERT INTO foo VALUES (8,'i','{"a8","b8","c8"}');
|
||||
INSERT INTO foo VALUES (9,'j','{"a9","b9","c9"}');
|
||||
-- misc utilities
|
||||
-- show the currently executing query
|
||||
SELECT 'hello' AS hello, dblink_current_query() AS query;
|
||||
hello | query
|
||||
-------+-----------------------------------------------------------
|
||||
hello | SELECT 'hello' AS hello, dblink_current_query() AS query;
|
||||
(1 row)
|
||||
|
||||
-- list the primary key fields
|
||||
SELECT *
|
||||
FROM dblink_get_pkey('foo');
|
||||
|
@ -27,9 +27,6 @@ INSERT INTO foo VALUES (9,'j','{"a9","b9","c9"}');
|
||||
|
||||
-- misc utilities
|
||||
|
||||
-- show the currently executing query
|
||||
SELECT 'hello' AS hello, dblink_current_query() AS query;
|
||||
|
||||
-- list the primary key fields
|
||||
SELECT *
|
||||
FROM dblink_get_pkey('foo');
|
||||
|
@ -1,10 +1,8 @@
|
||||
/* $PostgreSQL: pgsql/contrib/dblink/uninstall_dblink.sql,v 1.5 2007/11/13 04:24:27 momjian Exp $ */
|
||||
/* $PostgreSQL: pgsql/contrib/dblink/uninstall_dblink.sql,v 1.6 2008/04/04 16:57:21 momjian Exp $ */
|
||||
|
||||
-- Adjust this setting to control where the objects get dropped.
|
||||
SET search_path = public;
|
||||
|
||||
DROP FUNCTION dblink_current_query ();
|
||||
|
||||
DROP FUNCTION dblink_build_sql_update (text, int2vector, int4, _text, _text);
|
||||
|
||||
DROP FUNCTION dblink_build_sql_delete (text, int2vector, int4, _text);
|
||||
|
Reference in New Issue
Block a user