summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane2009-06-09 17:41:02 +0000
committerTom Lane2009-06-09 17:41:02 +0000
commit98884903e880edea160b996e2499ec73159339e1 (patch)
treeb6fd3330d05a0d8c72c4c36fef72f12e084101d3
parentfdb17362ad4ca499651f3f6cacc9e769c7afaf7d (diff)
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.c14
-rw-r--r--contrib/dblink/dblink.h1
-rw-r--r--contrib/dblink/dblink.sql.in4
3 files changed, 17 insertions, 2 deletions
diff --git a/contrib/dblink/dblink.c b/contrib/dblink/dblink.c
index dd35feef5d..1c52b0ff7c 100644
--- a/contrib/dblink/dblink.c
+++ b/contrib/dblink/dblink.c
@@ -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 3a6757581c..7dab7eed86 100644
--- a/contrib/dblink/dblink.h
+++ b/contrib/dblink/dblink.h
@@ -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 ab735a8781..c72a87e458 100644
--- a/contrib/dblink/dblink.sql.in
+++ b/contrib/dblink/dblink.sql.in
@@ -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