Skip to content

Commit f3e122f

Browse files
committed
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.
1 parent e8f28cb commit f3e122f

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

contrib/dblink/dblink.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Darko Prenosil <Darko.Prenosil@finteh.hr>
99
* Shridhar Daithankar <shridhar_daithankar@persistent.co.in>
1010
*
11-
* $PostgreSQL: pgsql/contrib/dblink/dblink.c,v 1.80 2009/06/09 16:35:36 joe Exp $
11+
* $PostgreSQL: pgsql/contrib/dblink/dblink.c,v 1.81 2009/06/09 17:41:02 tgl Exp $
1212
* Copyright (c) 2001-2009, PostgreSQL Global Development Group
1313
* ALL RIGHTS RESERVED;
1414
*
@@ -1622,6 +1622,20 @@ dblink_build_sql_update(PG_FUNCTION_ARGS)
16221622
PG_RETURN_TEXT_P(cstring_to_text(sql));
16231623
}
16241624

1625+
/*
1626+
* dblink_current_query
1627+
* return the current query string
1628+
* to allow its use in (among other things)
1629+
* rewrite rules
1630+
*/
1631+
PG_FUNCTION_INFO_V1(dblink_current_query);
1632+
Datum
1633+
dblink_current_query(PG_FUNCTION_ARGS)
1634+
{
1635+
/* This is now just an alias for the built-in function current_query() */
1636+
PG_RETURN_DATUM(current_query(fcinfo));
1637+
}
1638+
16251639
/*************************************************************
16261640
* internal functions
16271641
*/

contrib/dblink/dblink.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Darko Prenosil <Darko.Prenosil@finteh.hr>
99
* Shridhar Daithankar <shridhar_daithankar@persistent.co.in>
1010
*
11-
* $PostgreSQL: pgsql/contrib/dblink/dblink.h,v 1.21 2009/01/01 17:23:32 momjian Exp $
11+
* $PostgreSQL: pgsql/contrib/dblink/dblink.h,v 1.22 2009/06/09 17:41:02 tgl Exp $
1212
* Copyright (c) 2001-2009, PostgreSQL Global Development Group
1313
* ALL RIGHTS RESERVED;
1414
*
@@ -56,5 +56,6 @@ extern Datum dblink_get_pkey(PG_FUNCTION_ARGS);
5656
extern Datum dblink_build_sql_insert(PG_FUNCTION_ARGS);
5757
extern Datum dblink_build_sql_delete(PG_FUNCTION_ARGS);
5858
extern Datum dblink_build_sql_update(PG_FUNCTION_ARGS);
59+
extern Datum dblink_current_query(PG_FUNCTION_ARGS);
5960

6061
#endif /* DBLINK_H */

contrib/dblink/dblink.sql.in

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/contrib/dblink/dblink.sql.in,v 1.17 2008/04/05 02:44:42 momjian Exp $ */
1+
/* $PostgreSQL: pgsql/contrib/dblink/dblink.sql.in,v 1.18 2009/06/09 17:41:02 tgl Exp $ */
22

33
-- Adjust this setting to control where the objects get created.
44
SET search_path = public;
@@ -165,8 +165,8 @@ LANGUAGE C STRICT;
165165

166166
CREATE OR REPLACE FUNCTION dblink_current_query ()
167167
RETURNS text
168-
AS 'SELECT pg_catalog.current_query()'
169-
LANGUAGE SQL;
168+
AS 'MODULE_PATHNAME','dblink_current_query'
169+
LANGUAGE C;
170170

171171
CREATE OR REPLACE FUNCTION dblink_send_query(text, text)
172172
RETURNS int4

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy