Project

General

Profile

« Previous | Next » 

Revision 12554

schemas/util.sql: mk_diff_query(): removed special handling for CROSS JOIN because this is now handled by diff(text, text) using `FULL JOIN ON true`. this simplification allows mk_diff_query() to contain just the template structure of the FULL JOIN, without _if() calls that decrease readability.

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, false,
1061
		SELECT * FROM util.eval2col_pair(util.mk_diff_query($1, $2,
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)||$$
......
2048 2048

  
2049 2049

  
2050 2050
--
2051
-- Name: mk_diff_query(text, text, boolean, text, text, text); Type: FUNCTION; Schema: util; Owner: -
2051
-- Name: mk_diff_query(text, text, text, text, text); Type: FUNCTION; Schema: util; Owner: -
2052 2052
--
2053 2053

  
2054
CREATE FUNCTION mk_diff_query(left_ text, right_ text, single_row boolean DEFAULT false, cols text DEFAULT 'left_, right_'::text, join_cond text DEFAULT 'left_ %== right_ -- refer to EXPLAIN output for expansion of %=='::text, filter text DEFAULT 'left_ IS DISTINCT FROM right_'::text) RETURNS text
2054
CREATE FUNCTION mk_diff_query(left_ text, right_ text, cols text DEFAULT 'left_, right_'::text, join_cond text DEFAULT 'left_ %== right_ -- refer to EXPLAIN output for expansion of %=='::text, filter text DEFAULT 'left_ IS DISTINCT FROM right_'::text) RETURNS text
2055 2055
    LANGUAGE sql IMMUTABLE
2056 2056
    AS $_$
2057 2057
SELECT
2058 2058
$$SELECT
2059
$$||$4||$$
2059
$$||$3||$$
2060 2060
FROM $$||$1||$$ left_
2061
$$||util._if($3, 'CROSS'::text, 'FULL')||$$ JOIN $$||$2||$$ right_
2062
$$||util._if($3, ''::text,
2063
$$ON $$||$5||$$
2064
$$)||
2065
$$WHERE $$||$6||$$
2061
FULL JOIN $$||$2||$$ right_
2062
ON $$||$4||$$
2063
WHERE $$||$5||$$
2066 2064
ORDER BY left_, right_
2067 2065
$$
2068 2066
$_$;
2069 2067

  
2070 2068

  
2071 2069
--
2072
-- Name: FUNCTION mk_diff_query(left_ text, right_ text, single_row boolean, cols text, join_cond text, filter text); Type: COMMENT; Schema: util; Owner: -
2073
--
2074

  
2075
COMMENT ON FUNCTION mk_diff_query(left_ text, right_ text, single_row boolean, cols text, join_cond text, filter text) IS '
2076
single_row: whether the tables consist of a single row, which should be
2077
	displayed side-by-side
2078
';
2079

  
2080

  
2081
--
2082 2070
-- Name: mk_map_table(text); Type: FUNCTION; Schema: util; Owner: -
2083 2071
--
2084 2072

  

Also available in: Unified diff