Project

General

Profile

« Previous | Next » 

Revision 12475

schemas/util.sql: added mk_diff_query()

View differences:

util.sql
2042 2042

  
2043 2043

  
2044 2044
--
2045
-- Name: mk_diff_query(text, text, boolean); Type: FUNCTION; Schema: util; Owner: -
2046
--
2047

  
2048
CREATE FUNCTION mk_diff_query(left_ text, right_ text, single_row boolean DEFAULT false) RETURNS text
2049
    LANGUAGE sql IMMUTABLE
2050
    AS $_$
2051
SELECT
2052
$$SELECT left_, right_
2053
FROM $$||$1||$$ left_
2054
$$||util._if($3, 'CROSS'::text, 'FULL')||$$ JOIN $$||$2||$$ right_
2055
$$||util._if($3, ''::text,
2056
$$ON left_ %== right_ -- refer to EXPLAIN output for expansion of %==
2057
$$)||
2058
$$WHERE left_ IS DISTINCT FROM right_
2059
ORDER BY left_, right_
2060
$$
2061
$_$;
2062

  
2063

  
2064
--
2065
-- Name: FUNCTION mk_diff_query(left_ text, right_ text, single_row boolean); Type: COMMENT; Schema: util; Owner: -
2066
--
2067

  
2068
COMMENT ON FUNCTION mk_diff_query(left_ text, right_ text, single_row boolean) IS '
2069
single_row: whether the tables consist of a single row, which should be
2070
	displayed side-by-side
2071
';
2072

  
2073

  
2074
--
2045 2075
-- Name: mk_map_table(text); Type: FUNCTION; Schema: util; Owner: -
2046 2076
--
2047 2077

  

Also available in: Unified diff