Project

General

Profile

« Previous | Next » 

Revision 12498

schemas/util.sql: diff(text, text): documented how to write a custom keys() function to match up rows using a subset of the columns (including a sample keys() function template)

View differences:

trunk/schemas/util.sql
1083 1083
single_row: whether the tables consist of a single row, which should be
1084 1084
	displayed side-by-side
1085 1085

  
1086
to match up rows using a subset of the columns, create a custom keys() function
1087
which returns this subset as a record:
1088
-- note that OUT parameters for the returned fields are *not* needed
1089
CREATE OR REPLACE FUNCTION [schema].keys(value [schema].[base_type])
1090
  RETURNS record AS
1091
$BODY$
1092
SELECT ($1.key_field_0, $1.key_field_1)
1093
$BODY$
1094
  LANGUAGE sql IMMUTABLE
1095
  COST 100;
1096

  
1097

  
1086 1098
to run EXPLAIN on the FULL JOIN query:
1087 1099
# run this function
1088 1100
# look for a NOTICE containing the expanded query that it ran

Also available in: Unified diff