Project

General

Profile

« Previous | Next » 

Revision 12553

schemas/util.sql: diff(text, text): handle the CROSS JOIN special case using `FULL JOIN ON true`, to allow mk_diff_query() to support just a straighforward FULL JOIN. this also ensures that all diff queries use the same FULL JOIN template.

View differences:

trunk/schemas/util.sql
1058 1058
	PERFORM util.use_schema($3); -- includes util.%== as default/fallback
1059 1059
	
1060 1060
	RETURN QUERY
1061
		SELECT * FROM util.eval2col_pair(util.mk_diff_query($1, $2, $4,
1061
		SELECT * FROM util.eval2col_pair(util.mk_diff_query($1, $2, false,
1062 1062
$$/* need to explicitly cast each side to the return type because this does not
1063 1063
happen automatically even when an implicit cast is available */
1064 1064
  left_::$$||util.typeof($3)||$$
1065 1065
, right_::$$||util.typeof($3)
1066 1066
/* when using the util.%==(anyelement, anyelement) operator, you must cast to
1067 1067
the *same* base type, *even though* this is optional when using a custom %== */
1068
,$$ left_::$$||util.typeof($3)||$$
1068
, util._if($4, $$true/*= CROSS JOIN*/$$,
1069
$$ left_::$$||util.typeof($3)||$$
1069 1070
%== right_::$$||util.typeof($3)||$$
1070 1071
	-- refer to EXPLAIN output for expansion of %==$$
1071
), $3)
1072
)), $3)
1072 1073
	;
1073 1074
END;
1074 1075
$_$;

Also available in: Unified diff