aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2009-06-09 17:41:02 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2009-06-09 17:41:02 +0000
commitf3e122fcdf68fcc28c0d03971e19c318fe3bc405 (patch)
tree066078d8c6c8d2326d76dd7ada81078743dc5a79
parente8f28cb25d6f375d0d553b6fa16b398835951a1f (diff)
downloadpostgresql-f3e122fcdf68fcc28c0d03971e19c318fe3bc405.tar.gz
postgresql-f3e122fcdf68fcc28c0d03971e19c318fe3bc405.zip
Restore dblink_current_query() to being a C-language function, so as to not
create an ABI break between 8.3 and 8.4. It is still just a wrapper around the built-in current_query() function, but at a different implementation level. Per my proposal. Note: this change doesn't break 8.4beta installations, since their SQL-language definition of the function still works fine.
-rw-r--r--contrib/dblink/dblink.c16
-rw-r--r--contrib/dblink/dblink.h3
-rw-r--r--contrib/dblink/dblink.sql.in6
3 files changed, 20 insertions, 5 deletions
diff --git a/contrib/dblink/dblink.c b/contrib/dblink/dblink.c
index e709ae9cc3b..9cd047b1ead 100644
--- a/contrib/dblink/dblink.c
+++ b/contrib/dblink/dblink.c
@@ -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.80 2009/06/09 16:35:36 joe Exp $
+ * $PostgreSQL: pgsql/contrib/dblink/dblink.c,v 1.81 2009/06/09 17:41:02 tgl Exp $
* Copyright (c) 2001-2009, PostgreSQL Global Development Group
* ALL RIGHTS RESERVED;
*
@@ -1622,6 +1622,20 @@ 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)
+{
+ /* This is now just an alias for the built-in function current_query() */
+ PG_RETURN_DATUM(current_query(fcinfo));
+}
+
/*************************************************************
* internal functions
*/
diff --git a/contrib/dblink/dblink.h b/contrib/dblink/dblink.h
index 17d97e759fc..829748d8923 100644
--- a/contrib/dblink/dblink.h
+++ b/contrib/dblink/dblink.h
@@ -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.21 2009/01/01 17:23:32 momjian Exp $
+ * $PostgreSQL: pgsql/contrib/dblink/dblink.h,v 1.22 2009/06/09 17:41:02 tgl Exp $
* Copyright (c) 2001-2009, PostgreSQL Global Development Group
* ALL RIGHTS RESERVED;
*
@@ -56,5 +56,6 @@ 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 */
diff --git a/contrib/dblink/dblink.sql.in b/contrib/dblink/dblink.sql.in
index 6bd8b89f8e2..e774644dcfe 100644
--- a/contrib/dblink/dblink.sql.in
+++ b/contrib/dblink/dblink.sql.in
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/contrib/dblink/dblink.sql.in,v 1.17 2008/04/05 02:44:42 momjian Exp $ */
+/* $PostgreSQL: pgsql/contrib/dblink/dblink.sql.in,v 1.18 2009/06/09 17:41:02 tgl Exp $ */
-- Adjust this setting to control where the objects get created.
SET search_path = public;
@@ -165,8 +165,8 @@ LANGUAGE C STRICT;
CREATE OR REPLACE FUNCTION dblink_current_query ()
RETURNS text
-AS 'SELECT pg_catalog.current_query()'
-LANGUAGE SQL;
+AS 'MODULE_PATHNAME','dblink_current_query'
+LANGUAGE C;
CREATE OR REPLACE FUNCTION dblink_send_query(text, text)
RETURNS int4