Project

General

Profile

« Previous | Next » 

Revision 12472

fix: schemas/util.sql: eval2*(): added search_path function option in order to limit the effects of any `SET LOCAL search_path` in the invoked query to the current function. however, plain eval() is not changed because it is often used to execute a `SET LOCAL search_path` in the calling function.

View differences:

trunk/schemas/util.sql
1299 1299

  
1300 1300
CREATE FUNCTION eval2col_pair(sql text, col_type_null anyelement, OUT left_ anyelement, OUT right_ anyelement) RETURNS SETOF record
1301 1301
    LANGUAGE plpgsql
1302
    SET search_path TO pg_temp
1302 1303
    AS $$
1304
/* function option search_path is needed to limit the effects of any
1305
`SET LOCAL search_path` to the current function */
1303 1306
BEGIN
1304 1307
	PERFORM util.debug_print_sql(sql);
1305 1308
	RETURN QUERY EXECUTE sql;
......
1322 1325

  
1323 1326
CREATE FUNCTION eval2records(sql text) RETURNS SETOF record
1324 1327
    LANGUAGE plpgsql
1328
    SET search_path TO pg_temp
1325 1329
    AS $$
1330
/* function option search_path is needed to limit the effects of any
1331
`SET LOCAL search_path` to the current function */
1326 1332
BEGIN
1327 1333
	PERFORM util.debug_print_sql(sql);
1328 1334
	RETURN QUERY EXECUTE sql;
......
1336 1342

  
1337 1343
CREATE FUNCTION eval2set(sql text, ret_type_null anyelement DEFAULT NULL::text, verbose_ boolean DEFAULT true) RETURNS SETOF anyelement
1338 1344
    LANGUAGE plpgsql
1345
    SET search_path TO pg_temp
1339 1346
    AS $$
1347
/* function option search_path is needed to limit the effects of any
1348
`SET LOCAL search_path` to the current function */
1340 1349
BEGIN
1341 1350
	IF verbose_ THEN PERFORM util.debug_print_sql(sql); END IF;
1342 1351
	RETURN QUERY EXECUTE sql;
......
1350 1359

  
1351 1360
CREATE FUNCTION eval2val(sql text, ret_type_null anyelement DEFAULT NULL::text) RETURNS anyelement
1352 1361
    LANGUAGE plpgsql
1362
    SET search_path TO pg_temp
1353 1363
    AS $$
1364
/* function option search_path is needed to limit the effects of any
1365
`SET LOCAL search_path` to the current function */
1354 1366
DECLARE
1355 1367
	ret_val ret_type_null%TYPE;
1356 1368
BEGIN

Also available in: Unified diff