Project

General

Profile

« Previous | Next » 

Revision 12497

schemas/vegbien.sql: replaced custom %== operators with much simpler custom keys() functions. this avoids both the need to write out an = comparison for each field, and especially, also the need to write both an operator and a function implementing that operator.

View differences:

trunk/schemas/vegbien.my.sql
878 878

  
879 879

  
880 880
--
881
-- Name: %==(`~type._plots_04_count_of_plots_in_each_project_in_this_source`, `~type._plots_04_count_of_plots_in_each_project_in_this_source`); Type: FUNCTION; Schema: public_validations; Owner: -
881
-- Name: keys(`~type._plots_04_count_of_plots_in_each_project_in_this_source`); Type: FUNCTION; Schema: public_validations; Owner: -
882 882
--
883 883

  
884 884

  
......
895 895

  
896 896

  
897 897
--
898
-- Name: %==(`~type._traits_04_count_records_per_trait`, `~type._traits_04_count_records_per_trait`); Type: FUNCTION; Schema: public_validations; Owner: -
898
-- Name: keys(`~type._traits_04_count_records_per_trait`); Type: FUNCTION; Schema: public_validations; Owner: -
899 899
--
900 900

  
901 901

  
......
1070 1070

  
1071 1071

  
1072 1072
--
1073
-- Name: %==; Type: OPERATOR; Schema: public_validations; Owner: -
1073
-- Name: ~type._traits_01_count_records; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
1074 1074
--
1075 1075

  
1076
CREATE OPERATOR %== (
1077
    PROCEDURE = `%==`,
1078
    LEFTARG = `~type._traits_04_count_records_per_trait`,
1079
    RIGHTARG = `~type._traits_04_count_records_per_trait`
1076
CREATE TABLE `~type._traits_01_count_records` (
1077
    `totalRecords` varchar(255)
1080 1078
);
1081 1079

  
1082 1080

  
1083 1081
--
1084
-- Name: %==; Type: OPERATOR; Schema: public_validations; Owner: -
1082
-- Name: ~type._traits_02_count_trait_names; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
1085 1083
--
1086 1084

  
1087
CREATE OPERATOR %== (
1088
    PROCEDURE = `%==`,
1089
    LEFTARG = `~type._plots_04_count_of_plots_in_each_project_in_this_source`,
1090
    RIGHTARG = `~type._plots_04_count_of_plots_in_each_project_in_this_source`
1085
CREATE TABLE `~type._traits_02_count_trait_names` (
1086
    traits varchar(255)
1091 1087
);
1092 1088

  
1093 1089

  
1090
--
1091
-- Name: ~type._traits_03_list_trait_names; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
1092
--
1094 1093

  
1094
CREATE TABLE `~type._traits_03_list_trait_names` (
1095
    trait varchar(255)
1096
);
1095 1097

  
1098

  
1096 1099
--
1100
-- Name: ~type._traits_05_count_taxa; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
1101
--
1102

  
1103
CREATE TABLE `~type._traits_05_count_taxa` (
1104
    taxa varchar(255)
1105
);
1106

  
1107

  
1108
--
1109
-- Name: ~type._traits_06_list_distinct_taxa; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
1110
--
1111

  
1112
CREATE TABLE `~type._traits_06_list_distinct_taxa` (
1113
    taxonwithauthor varchar(255)
1114
);
1115

  
1116

  
1117
--
1118
-- Name: ~type._traits_07_trait_value_and_units; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
1119
--
1120

  
1121
CREATE TABLE `~type._traits_07_trait_value_and_units` (
1122
    trait varchar(255),
1123
    value varchar(255),
1124
    units varchar(255)
1125
);
1126

  
1127

  
1128
--
1129
-- Name: ~type._traits_08_taxonname_trait_and_value; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
1130
--
1131

  
1132
CREATE TABLE `~type._traits_08_taxonname_trait_and_value` (
1133
    taxonwithauthor varchar(255),
1134
    trait varchar(255),
1135
    value varchar(255)
1136
);
1137

  
1138

  
1139

  
1140

  
1141
--
1097 1142
-- Name: analytical_stem; Type: TABLE; Schema: public; Owner: -; Tablespace: 
1098 1143
--
1099 1144

  
......
3931 3976
);
3932 3977

  
3933 3978

  
3934
--
3935
-- Name: ~type._traits_01_count_records; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
3936
--
3937 3979

  
3938
CREATE TABLE `~type._traits_01_count_records` (
3939
    `totalRecords` varchar(255)
3940
);
3941 3980

  
3942

  
3943 3981
--
3944
-- Name: ~type._traits_02_count_trait_names; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
3945
--
3946

  
3947
CREATE TABLE `~type._traits_02_count_trait_names` (
3948
    traits varchar(255)
3949
);
3950

  
3951

  
3952
--
3953
-- Name: ~type._traits_03_list_trait_names; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
3954
--
3955

  
3956
CREATE TABLE `~type._traits_03_list_trait_names` (
3957
    trait varchar(255)
3958
);
3959

  
3960

  
3961
--
3962
-- Name: ~type._traits_05_count_taxa; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
3963
--
3964

  
3965
CREATE TABLE `~type._traits_05_count_taxa` (
3966
    taxa varchar(255)
3967
);
3968

  
3969

  
3970
--
3971
-- Name: ~type._traits_06_list_distinct_taxa; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
3972
--
3973

  
3974
CREATE TABLE `~type._traits_06_list_distinct_taxa` (
3975
    taxonwithauthor varchar(255)
3976
);
3977

  
3978

  
3979
--
3980
-- Name: ~type._traits_07_trait_value_and_units; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
3981
--
3982

  
3983
CREATE TABLE `~type._traits_07_trait_value_and_units` (
3984
    trait varchar(255),
3985
    value varchar(255),
3986
    units varchar(255)
3987
);
3988

  
3989

  
3990
--
3991
-- Name: ~type._traits_08_taxonname_trait_and_value; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
3992
--
3993

  
3994
CREATE TABLE `~type._traits_08_taxonname_trait_and_value` (
3995
    taxonwithauthor varchar(255),
3996
    trait varchar(255),
3997
    value varchar(255)
3998
);
3999

  
4000

  
4001

  
4002

  
4003
--
4004 3982
-- Name: address_id; Type: DEFAULT; Schema: public; Owner: -
4005 3983
--
4006 3984

  
trunk/schemas/vegbien.sql
1961 1961

  
1962 1962

  
1963 1963
--
1964
-- Name: %==("~type._plots_04_count_of_plots_in_each_project_in_this_source", "~type._plots_04_count_of_plots_in_each_project_in_this_source"); Type: FUNCTION; Schema: public_validations; Owner: -
1964
-- Name: keys("~type._plots_04_count_of_plots_in_each_project_in_this_source"); Type: FUNCTION; Schema: public_validations; Owner: -
1965 1965
--
1966 1966

  
1967
CREATE FUNCTION "%=="(left_ "~type._plots_04_count_of_plots_in_each_project_in_this_source", right_ "~type._plots_04_count_of_plots_in_each_project_in_this_source") RETURNS boolean
1967
CREATE FUNCTION keys(value "~type._plots_04_count_of_plots_in_each_project_in_this_source") RETURNS record
1968 1968
    LANGUAGE sql IMMUTABLE
1969 1969
    AS $_$
1970
SELECT $1.project_name = $2.project_name
1970
SELECT $1.project_name
1971 1971
$_$;
1972 1972

  
1973 1973

  
......
1982 1982

  
1983 1983

  
1984 1984
--
1985
-- Name: %==("~type._traits_04_count_records_per_trait", "~type._traits_04_count_records_per_trait"); Type: FUNCTION; Schema: public_validations; Owner: -
1985
-- Name: keys("~type._traits_04_count_records_per_trait"); Type: FUNCTION; Schema: public_validations; Owner: -
1986 1986
--
1987 1987

  
1988
CREATE FUNCTION "%=="(left_ "~type._traits_04_count_records_per_trait", right_ "~type._traits_04_count_records_per_trait") RETURNS boolean
1988
CREATE FUNCTION keys(value "~type._traits_04_count_records_per_trait") RETURNS record
1989 1989
    LANGUAGE sql IMMUTABLE
1990 1990
    AS $_$
1991
SELECT $1.trait = $2.trait
1991
SELECT $1.trait
1992 1992
$_$;
1993 1993

  
1994 1994

  
......
2422 2422

  
2423 2423

  
2424 2424
--
2425
-- Name: %==; Type: OPERATOR; Schema: public_validations; Owner: -
2425
-- Name: ~type._traits_01_count_records; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
2426 2426
--
2427 2427

  
2428
CREATE OPERATOR %== (
2429
    PROCEDURE = "%==",
2430
    LEFTARG = "~type._traits_04_count_records_per_trait",
2431
    RIGHTARG = "~type._traits_04_count_records_per_trait"
2428
CREATE TABLE "~type._traits_01_count_records" (
2429
    "totalRecords" bigint
2432 2430
);
2433 2431

  
2434 2432

  
2435 2433
--
2436
-- Name: %==; Type: OPERATOR; Schema: public_validations; Owner: -
2434
-- Name: ~type._traits_02_count_trait_names; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
2437 2435
--
2438 2436

  
2439
CREATE OPERATOR %== (
2440
    PROCEDURE = "%==",
2441
    LEFTARG = "~type._plots_04_count_of_plots_in_each_project_in_this_source",
2442
    RIGHTARG = "~type._plots_04_count_of_plots_in_each_project_in_this_source"
2437
CREATE TABLE "~type._traits_02_count_trait_names" (
2438
    traits bigint
2443 2439
);
2444 2440

  
2445 2441

  
2442
--
2443
-- Name: ~type._traits_03_list_trait_names; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
2444
--
2445

  
2446
CREATE TABLE "~type._traits_03_list_trait_names" (
2447
    trait text
2448
);
2449

  
2450

  
2451
--
2452
-- Name: ~type._traits_05_count_taxa; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
2453
--
2454

  
2455
CREATE TABLE "~type._traits_05_count_taxa" (
2456
    taxa bigint
2457
);
2458

  
2459

  
2460
--
2461
-- Name: ~type._traits_06_list_distinct_taxa; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
2462
--
2463

  
2464
CREATE TABLE "~type._traits_06_list_distinct_taxa" (
2465
    taxonwithauthor text
2466
);
2467

  
2468

  
2469
--
2470
-- Name: ~type._traits_07_trait_value_and_units; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
2471
--
2472

  
2473
CREATE TABLE "~type._traits_07_trait_value_and_units" (
2474
    trait text,
2475
    value text,
2476
    units text
2477
);
2478

  
2479

  
2480
--
2481
-- Name: ~type._traits_08_taxonname_trait_and_value; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
2482
--
2483

  
2484
CREATE TABLE "~type._traits_08_taxonname_trait_and_value" (
2485
    taxonwithauthor text,
2486
    trait text,
2487
    value text
2488
);
2489

  
2490

  
2446 2491
SET search_path = public, pg_catalog;
2447 2492

  
2448 2493
--
......
6384 6429
);
6385 6430

  
6386 6431

  
6387
--
6388
-- Name: ~type._traits_01_count_records; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
6389
--
6390

  
6391
CREATE TABLE "~type._traits_01_count_records" (
6392
    "totalRecords" bigint
6393
);
6394

  
6395

  
6396
--
6397
-- Name: ~type._traits_02_count_trait_names; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
6398
--
6399

  
6400
CREATE TABLE "~type._traits_02_count_trait_names" (
6401
    traits bigint
6402
);
6403

  
6404

  
6405
--
6406
-- Name: ~type._traits_03_list_trait_names; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
6407
--
6408

  
6409
CREATE TABLE "~type._traits_03_list_trait_names" (
6410
    trait text
6411
);
6412

  
6413

  
6414
--
6415
-- Name: ~type._traits_05_count_taxa; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
6416
--
6417

  
6418
CREATE TABLE "~type._traits_05_count_taxa" (
6419
    taxa bigint
6420
);
6421

  
6422

  
6423
--
6424
-- Name: ~type._traits_06_list_distinct_taxa; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
6425
--
6426

  
6427
CREATE TABLE "~type._traits_06_list_distinct_taxa" (
6428
    taxonwithauthor text
6429
);
6430

  
6431

  
6432
--
6433
-- Name: ~type._traits_07_trait_value_and_units; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
6434
--
6435

  
6436
CREATE TABLE "~type._traits_07_trait_value_and_units" (
6437
    trait text,
6438
    value text,
6439
    units text
6440
);
6441

  
6442

  
6443
--
6444
-- Name: ~type._traits_08_taxonname_trait_and_value; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
6445
--
6446

  
6447
CREATE TABLE "~type._traits_08_taxonname_trait_and_value" (
6448
    taxonwithauthor text,
6449
    trait text,
6450
    value text
6451
);
6452

  
6453

  
6454 6432
SET search_path = public, pg_catalog;
6455 6433

  
6456 6434
--

Also available in: Unified diff