Project

General

Profile

« Previous | Next » 

Revision 12366

bugfix: schemas/vegbien.sql: query_relations(), new_query_view_relation_name(): need to take into account the prefix when determining truncation, using the max_prefix_len param

View differences:

trunk/schemas/vegbien.my.sql
868 868

  
869 869

  
870 870
--
871
-- Name: new_query_view_relation_name(varchar(255), varchar(255), varchar(255)); Type: FUNCTION; Schema: public_validations; Owner: -
871
-- Name: query_view_relation_max_prefix_len(); Type: FUNCTION; Schema: public_validations; Owner: -
872 872
--
873 873

  
874 874

  
875 875

  
876 876

  
877 877
--
878
-- Name: query_relations(regclass); Type: FUNCTION; Schema: public_validations; Owner: -
878
-- Name: new_query_view_relation_name(varchar(255), varchar(255), varchar(255), int(11)); Type: FUNCTION; Schema: public_validations; Owner: -
879 879
--
880 880

  
881 881

  
882 882

  
883 883

  
884 884
--
885
-- Name: query_view_relation_max_prefix_len(); Type: FUNCTION; Schema: public_validations; Owner: -
885
-- Name: FUNCTION new_query_view_relation_name(query_view_from varchar(255), query_view_to varchar(255), relation_from varchar(255), max_prefix_len int(11)); Type: COMMENT; Schema: public_validations; Owner: -
886 886
--
887 887

  
888 888

  
889 889

  
890 890

  
891 891
--
892
-- Name: query_relations(regclass, int(11)); Type: FUNCTION; Schema: public_validations; Owner: -
893
--
894

  
895

  
896

  
897

  
898
--
899
-- Name: FUNCTION query_relations(query_view regclass, max_prefix_len int(11)); Type: COMMENT; Schema: public_validations; Owner: -
900
--
901

  
902

  
903

  
904

  
905
--
892 906
-- Name: remake_diff_table(regclass, anyelement); Type: FUNCTION; Schema: public_validations; Owner: -
893 907
--
894 908

  
trunk/schemas/vegbien.sql
1951 1951
SET search_path = public_validations, pg_catalog;
1952 1952

  
1953 1953
--
1954
-- Name: new_query_view_relation_name(text, text, text); Type: FUNCTION; Schema: public_validations; Owner: -
1954
-- Name: query_view_relation_max_prefix_len(); Type: FUNCTION; Schema: public_validations; Owner: -
1955 1955
--
1956 1956

  
1957
CREATE FUNCTION new_query_view_relation_name(query_view_from text, query_view_to text, relation_from text) RETURNS text
1957
CREATE FUNCTION query_view_relation_max_prefix_len() RETURNS integer
1958 1958
    LANGUAGE sql IMMUTABLE
1959
    AS $$
1960
SELECT 6/*len of '~type.', '_diff_'*/
1961
$$;
1962

  
1963

  
1964
--
1965
-- Name: new_query_view_relation_name(text, text, text, integer); Type: FUNCTION; Schema: public_validations; Owner: -
1966
--
1967

  
1968
CREATE FUNCTION new_query_view_relation_name(query_view_from text, query_view_to text, relation_from text, max_prefix_len integer DEFAULT query_view_relation_max_prefix_len()) RETURNS text
1969
    LANGUAGE sql IMMUTABLE
1959 1970
    AS $_$
1960
SELECT util.replace_suffix($3, $1, $2)
1971
SELECT util.replace_suffix($3, $1, $2, $4)
1961 1972
$_$;
1962 1973

  
1963 1974

  
1964 1975
--
1965
-- Name: query_relations(regclass); Type: FUNCTION; Schema: public_validations; Owner: -
1976
-- Name: FUNCTION new_query_view_relation_name(query_view_from text, query_view_to text, relation_from text, max_prefix_len integer); Type: COMMENT; Schema: public_validations; Owner: -
1966 1977
--
1967 1978

  
1968
CREATE FUNCTION query_relations(query_view regclass) RETURNS SETOF regclass
1979
COMMENT ON FUNCTION new_query_view_relation_name(query_view_from text, query_view_to text, relation_from text, max_prefix_len integer) IS '
1980
max_prefix_len: when str may have been truncated (eg. as a table name) due to
1981
	the prepending of a prefix, support prefixes up to this length. should be
1982
	left as the default value.
1983
';
1984

  
1985

  
1986
--
1987
-- Name: query_relations(regclass, integer); Type: FUNCTION; Schema: public_validations; Owner: -
1988
--
1989

  
1990
CREATE FUNCTION query_relations(query_view regclass, max_prefix_len integer DEFAULT query_view_relation_max_prefix_len()) RETURNS SETOF regclass
1969 1991
    LANGUAGE sql STABLE
1970 1992
    AS $_$
1971
SELECT *
1972
FROM util.show_relations_like('^.*'||util.regexp_quote(util.name($1))||'$')
1993
SELECT * FROM util.show_relations_like(
1994
util.truncated_prefixed_name_regexp(util.name($1), $2))
1973 1995
$_$;
1974 1996

  
1975 1997

  
1976 1998
--
1977
-- Name: query_view_relation_max_prefix_len(); Type: FUNCTION; Schema: public_validations; Owner: -
1999
-- Name: FUNCTION query_relations(query_view regclass, max_prefix_len integer); Type: COMMENT; Schema: public_validations; Owner: -
1978 2000
--
1979 2001

  
1980
CREATE FUNCTION query_view_relation_max_prefix_len() RETURNS integer
1981
    LANGUAGE sql IMMUTABLE
1982
    AS $$
1983
SELECT 6/*len of '~type.', '_diff_'*/
1984
$$;
2002
COMMENT ON FUNCTION query_relations(query_view regclass, max_prefix_len integer) IS '
2003
max_prefix_len: when str may have been truncated (eg. as a table name) due to
2004
	the prepending of a prefix, support prefixes up to this length. should be
2005
	left as the default value.
2006
';
1985 2007

  
1986 2008

  
1987 2009
--

Also available in: Unified diff