Revision 12424
Added by Aaron Marcuse-Kubitza almost 11 years ago
trunk/schemas/util.sql | ||
---|---|---|
1025 | 1025 |
|
1026 | 1026 |
CREATE FUNCTION diff(left_ text, right_ text, col_type_null anyelement, single_row boolean DEFAULT false, OUT left_ anyelement, OUT right_ anyelement) RETURNS SETOF record |
1027 | 1027 |
LANGUAGE sql STABLE |
1028 |
SET search_path TO util |
|
1028 | 1029 |
AS $_$ |
1029 | 1030 |
SELECT * FROM |
1030 | 1031 |
util.eval2col_pair($$ |
... | ... | |
1034 | 1035 |
FROM $$||$1||$$ left_ |
1035 | 1036 |
$$||util._if($4, 'CROSS'::text, 'FULL')||$$ JOIN $$||$2||$$ right_ |
1036 | 1037 |
$$||util._if($4, ''::text, |
1037 |
$$ON left_::$$||pg_typeof($3)||$$ = right_::$$||pg_typeof($3)||$$ |
|
1038 |
$$ON left_::$$||pg_typeof($3)||$$ %== right_::$$||pg_typeof($3)||$$
|
|
1038 | 1039 |
$$)|| |
1039 | 1040 |
$$WHERE left_::$$||pg_typeof($3)||$$ IS DISTINCT FROM right_::$$||pg_typeof($3)||$$ |
1040 | 1041 |
ORDER BY left_, right_ |
trunk/schemas/vegbien.my.sql | ||
---|---|---|
878 | 878 |
|
879 | 879 |
|
880 | 880 |
-- |
881 |
-- Name: =(`~type._traits_04_count_records_per_trait`, `~type._traits_04_count_records_per_trait`); Type: FUNCTION; Schema: public_validations; Owner: - |
|
881 |
-- Name: %==(`~type._traits_04_count_records_per_trait`, `~type._traits_04_count_records_per_trait`); Type: FUNCTION; Schema: public_validations; Owner: -
|
|
882 | 882 |
-- |
883 | 883 |
|
884 | 884 |
|
... | ... | |
1053 | 1053 |
|
1054 | 1054 |
|
1055 | 1055 |
-- |
1056 |
-- Name: =; Type: OPERATOR; Schema: public_validations; Owner: - |
|
1056 |
-- Name: %==; Type: OPERATOR; Schema: public_validations; Owner: -
|
|
1057 | 1057 |
-- |
1058 | 1058 |
|
1059 |
CREATE OPERATOR = ( |
|
1060 |
PROCEDURE = `=`, |
|
1059 |
CREATE OPERATOR %== (
|
|
1060 |
PROCEDURE = `%==`,
|
|
1061 | 1061 |
LEFTARG = `~type._traits_04_count_records_per_trait`, |
1062 | 1062 |
RIGHTARG = `~type._traits_04_count_records_per_trait` |
1063 | 1063 |
); |
trunk/schemas/vegbien.sql | ||
---|---|---|
1961 | 1961 |
|
1962 | 1962 |
|
1963 | 1963 |
-- |
1964 |
-- Name: =("~type._traits_04_count_records_per_trait", "~type._traits_04_count_records_per_trait"); Type: FUNCTION; Schema: public_validations; Owner: - |
|
1964 |
-- Name: %==("~type._traits_04_count_records_per_trait", "~type._traits_04_count_records_per_trait"); Type: FUNCTION; Schema: public_validations; Owner: -
|
|
1965 | 1965 |
-- |
1966 | 1966 |
|
1967 |
CREATE FUNCTION "="(left_ "~type._traits_04_count_records_per_trait", right_ "~type._traits_04_count_records_per_trait") RETURNS boolean |
|
1967 |
CREATE FUNCTION "%=="(left_ "~type._traits_04_count_records_per_trait", right_ "~type._traits_04_count_records_per_trait") RETURNS boolean
|
|
1968 | 1968 |
LANGUAGE sql IMMUTABLE |
1969 | 1969 |
AS $_$ |
1970 | 1970 |
SELECT $1.trait = $2.trait |
... | ... | |
2401 | 2401 |
|
2402 | 2402 |
|
2403 | 2403 |
-- |
2404 |
-- Name: =; Type: OPERATOR; Schema: public_validations; Owner: - |
|
2404 |
-- Name: %==; Type: OPERATOR; Schema: public_validations; Owner: -
|
|
2405 | 2405 |
-- |
2406 | 2406 |
|
2407 |
CREATE OPERATOR = ( |
|
2408 |
PROCEDURE = "=", |
|
2407 |
CREATE OPERATOR %== (
|
|
2408 |
PROCEDURE = "%==",
|
|
2409 | 2409 |
LEFTARG = "~type._traits_04_count_records_per_trait", |
2410 | 2410 |
RIGHTARG = "~type._traits_04_count_records_per_trait" |
2411 | 2411 |
); |
Also available in: Unified diff
bugfix: schemas/util.sql: diff(text, text) and types that use its custom FULL JOIN matching: need to use separate operator %== for determining which records to put on the same row, so that the = filter for identical rows only excludes rows that are actually the same, not all rows with the same keys (which would usually remove all rows)