Project

General

Profile

« Previous | Next » 

Revision 14282

bugfix: schemas/util.sql: derived_col_update(): column comment: need to use expr from DB, not as provided by user, to avoid this changing when derived_col_update() is rerun

View differences:

trunk/inputs/.TNRS/schema.sql
241 241
	
242 242
	new."[scrubbed_]taxonRank__@DwC__@vegpath.org" = (SELECT
243 243
		CASE
244
        WHEN matched_has_accepted THEN "*Accepted_name_rank"
245
        ELSE "*Name_matched_rank"
246
    END
244
    WHEN matched_has_accepted THEN "*Accepted_name_rank"
245
    ELSE "*Name_matched_rank"
246
END
247 247
		FROM (SELECT new.*) new);
248 248
	
249 249
	new."[scrubbed_]family~(-Accepted_-)__@TNRS__@vegpath.org" = (SELECT
250 250
		CASE
251
        WHEN matched_has_accepted THEN "*Accepted_name_family"
252
        ELSE "*Name_matched_accepted_family"
253
    END
251
    WHEN matched_has_accepted THEN "*Accepted_name_family"
252
    ELSE "*Name_matched_accepted_family"
253
END
254 254
		FROM (SELECT new.*) new);
255 255
	
256 256
	new."[scrubbed_]genus__@DwC__@vegpath.org" = (SELECT
257 257
		CASE
258
        WHEN matched_has_accepted THEN "[accepted_]genus__@DwC__@vegpath.org"
259
        ELSE "*Genus_matched"
260
    END
258
    WHEN matched_has_accepted THEN "[accepted_]genus__@DwC__@vegpath.org"
259
    ELSE "*Genus_matched"
260
END
261 261
		FROM (SELECT new.*) new);
262 262
	
263 263
	new."[scrubbed_]specificEpithet__@DwC__@vegpath.org" = (SELECT
264 264
		CASE
265
        WHEN matched_has_accepted THEN "[accepted_]specificEpithet__@DwC__@vegpath.org"
266
        ELSE "*Specific_epithet_matched"
267
    END
265
    WHEN matched_has_accepted THEN "[accepted_]specificEpithet__@DwC__@vegpath.org"
266
    ELSE "*Specific_epithet_matched"
267
END
268 268
		FROM (SELECT new.*) new);
269 269
	
270 270
	new."[scrubbed_]species[_binom]~(-Accepted_-)__@TNRS__@vegpath.org" = (SELECT
271 271
		CASE
272
        WHEN matched_has_accepted THEN "*Accepted_name_species"
273
        ELSE "[matched_]species[_binomial]~(-Accepted_-)__@TNRS__@vegpath.org"
274
    END
272
    WHEN matched_has_accepted THEN "*Accepted_name_species"
273
    ELSE "[matched_]species[_binomial]~(-Accepted_-)__@TNRS__@vegpath.org"
274
END
275 275
		FROM (SELECT new.*) new);
276 276
	
277 277
	new."[scrubbed_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org" = (SELECT
278 278
		CASE
279
        WHEN matched_has_accepted THEN "[accepted_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org"
280
        ELSE "*Infraspecific_rank"
281
    END
279
    WHEN matched_has_accepted THEN "[accepted_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org"
280
    ELSE "*Infraspecific_rank"
281
END
282 282
		FROM (SELECT new.*) new);
283 283
	
284 284
	new."[scrubbed_]infraspecificEpithet__@DwC__@vegpath.org" = (SELECT
285 285
		CASE
286
        WHEN matched_has_accepted THEN "[accepted_]specificEpithet__@DwC__@vegpath.org"
287
        ELSE "*Infraspecific_epithet_matched"
288
    END
286
    WHEN matched_has_accepted THEN "[accepted_]specificEpithet__@DwC__@vegpath.org"
287
    ELSE "*Infraspecific_epithet_matched"
288
END
289 289
		FROM (SELECT new.*) new);
290 290
	
291 291
	new."[scrubbed_]name[_no_author]~(-Accepted_-)__@TNRS__@vegpath.org" = (SELECT
292 292
		CASE
293
        WHEN matched_has_accepted THEN "*Accepted_name"
294
        ELSE "*Name_matched"
295
    END
293
    WHEN matched_has_accepted THEN "*Accepted_name"
294
    ELSE "*Name_matched"
295
END
296 296
		FROM (SELECT new.*) new);
297 297
	
298 298
	new."[scrubbed_]author~(-Accepted_-)__@TNRS__@vegpath.org" = (SELECT
299 299
		CASE
300
        WHEN matched_has_accepted THEN "*Accepted_name_author"
301
        ELSE "*Name_matched_author"
302
    END
300
    WHEN matched_has_accepted THEN "*Accepted_name_author"
301
    ELSE "*Name_matched_author"
302
END
303 303
		FROM (SELECT new.*) new);
304 304
	
305 305
	new."[scrubbed_]scientificName[_with_author]__@DwC__@vegpath.org" = (SELECT
306 306
		CASE
307
        WHEN matched_has_accepted THEN "[accepted_]scientificName[_with_author]__@DwC__@vegpath.org"
308
        ELSE "[matched_]scientificName[_with_author]__@DwC__@vegpath.org"
309
    END
307
    WHEN matched_has_accepted THEN "[accepted_]scientificName[_with_author]__@DwC__@vegpath.org"
308
    ELSE "[matched_]scientificName[_with_author]__@DwC__@vegpath.org"
309
END
310 310
		FROM (SELECT new.*) new);
311 311
	
312 312
	RETURN new;
......
561 561
derived column; = ("*Genus_matched" || '' ''::text) || "*Specific_epithet_matched"
562 562

  
563 563
to modify expr:
564
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[matched_]species[_binomial]~(-Accepted_-)__@TNRS__@vegpath.org'')::util.col, $$"*Genus_matched" || '' ''::text || "*Specific_epithet_matched"$$)::util.derived_col_def);
564
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[matched_]species[_binomial]~(-Accepted_-)__@TNRS__@vegpath.org'')::util.col, $$("*Genus_matched" || '' ''::text) || "*Specific_epithet_matched"$$)::util.derived_col_def);
565 565
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
566 566

  
567 567
to rename:
......
757 757

  
758 758
COMMENT ON COLUMN taxon_match."[scrubbed_]taxonRank__@DwC__@vegpath.org" IS '
759 759
derived column; = CASE
760
        WHEN matched_has_accepted THEN "*Accepted_name_rank"
761
        ELSE "*Name_matched_rank"
762
    END
760
    WHEN matched_has_accepted THEN "*Accepted_name_rank"
761
    ELSE "*Name_matched_rank"
762
END
763 763

  
764 764
to modify expr:
765
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[scrubbed_]taxonRank__@DwC__@vegpath.org'')::util.col, $$CASE WHEN matched_has_accepted THEN "*Accepted_name_rank" ELSE "*Name_matched_rank" END$$)::util.derived_col_def);
765
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[scrubbed_]taxonRank__@DwC__@vegpath.org'')::util.col, $$CASE
766
    WHEN matched_has_accepted THEN "*Accepted_name_rank"
767
    ELSE "*Name_matched_rank"
768
END$$)::util.derived_col_def);
766 769
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
767 770

  
768 771
to rename:
......
778 781

  
779 782
COMMENT ON COLUMN taxon_match."[scrubbed_]family~(-Accepted_-)__@TNRS__@vegpath.org" IS '
780 783
derived column; = CASE
781
        WHEN matched_has_accepted THEN "*Accepted_name_family"
782
        ELSE "*Name_matched_accepted_family"
783
    END
784
    WHEN matched_has_accepted THEN "*Accepted_name_family"
785
    ELSE "*Name_matched_accepted_family"
786
END
784 787

  
785 788
to modify expr:
786
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[scrubbed_]family~(-Accepted_-)__@TNRS__@vegpath.org'')::util.col, $$CASE WHEN matched_has_accepted THEN "*Accepted_name_family" ELSE "*Name_matched_accepted_family" END$$)::util.derived_col_def);
789
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[scrubbed_]family~(-Accepted_-)__@TNRS__@vegpath.org'')::util.col, $$CASE
790
    WHEN matched_has_accepted THEN "*Accepted_name_family"
791
    ELSE "*Name_matched_accepted_family"
792
END$$)::util.derived_col_def);
787 793
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
788 794

  
789 795
to rename:
......
799 805

  
800 806
COMMENT ON COLUMN taxon_match."[scrubbed_]genus__@DwC__@vegpath.org" IS '
801 807
derived column; = CASE
802
        WHEN matched_has_accepted THEN "[accepted_]genus__@DwC__@vegpath.org"
803
        ELSE "*Genus_matched"
804
    END
808
    WHEN matched_has_accepted THEN "[accepted_]genus__@DwC__@vegpath.org"
809
    ELSE "*Genus_matched"
810
END
805 811

  
806 812
to modify expr:
807
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[scrubbed_]genus__@DwC__@vegpath.org'')::util.col, $$CASE WHEN matched_has_accepted THEN "[accepted_]genus__@DwC__@vegpath.org" ELSE "*Genus_matched" END$$)::util.derived_col_def);
813
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[scrubbed_]genus__@DwC__@vegpath.org'')::util.col, $$CASE
814
    WHEN matched_has_accepted THEN "[accepted_]genus__@DwC__@vegpath.org"
815
    ELSE "*Genus_matched"
816
END$$)::util.derived_col_def);
808 817
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
809 818

  
810 819
to rename:
......
820 829

  
821 830
COMMENT ON COLUMN taxon_match."[scrubbed_]specificEpithet__@DwC__@vegpath.org" IS '
822 831
derived column; = CASE
823
        WHEN matched_has_accepted THEN "[accepted_]specificEpithet__@DwC__@vegpath.org"
824
        ELSE "*Specific_epithet_matched"
825
    END
832
    WHEN matched_has_accepted THEN "[accepted_]specificEpithet__@DwC__@vegpath.org"
833
    ELSE "*Specific_epithet_matched"
834
END
826 835

  
827 836
to modify expr:
828
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[scrubbed_]specificEpithet__@DwC__@vegpath.org'')::util.col, $$CASE WHEN matched_has_accepted THEN "[accepted_]specificEpithet__@DwC__@vegpath.org" ELSE "*Specific_epithet_matched" END$$)::util.derived_col_def);
837
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[scrubbed_]specificEpithet__@DwC__@vegpath.org'')::util.col, $$CASE
838
    WHEN matched_has_accepted THEN "[accepted_]specificEpithet__@DwC__@vegpath.org"
839
    ELSE "*Specific_epithet_matched"
840
END$$)::util.derived_col_def);
829 841
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
830 842

  
831 843
to rename:
......
841 853

  
842 854
COMMENT ON COLUMN taxon_match."[scrubbed_]species[_binom]~(-Accepted_-)__@TNRS__@vegpath.org" IS '
843 855
derived column; = CASE
844
        WHEN matched_has_accepted THEN "*Accepted_name_species"
845
        ELSE "[matched_]species[_binomial]~(-Accepted_-)__@TNRS__@vegpath.org"
846
    END
856
    WHEN matched_has_accepted THEN "*Accepted_name_species"
857
    ELSE "[matched_]species[_binomial]~(-Accepted_-)__@TNRS__@vegpath.org"
858
END
847 859

  
848 860
to modify expr:
849
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[scrubbed_]species[_binom]~(-Accepted_-)__@TNRS__@vegpath.org'')::util.col, $$CASE WHEN matched_has_accepted THEN "*Accepted_name_species" ELSE "[matched_]species[_binomial]~(-Accepted_-)__@TNRS__@vegpath.org" END$$)::util.derived_col_def);
861
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[scrubbed_]species[_binom]~(-Accepted_-)__@TNRS__@vegpath.org'')::util.col, $$CASE
862
    WHEN matched_has_accepted THEN "*Accepted_name_species"
863
    ELSE "[matched_]species[_binomial]~(-Accepted_-)__@TNRS__@vegpath.org"
864
END$$)::util.derived_col_def);
850 865
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
851 866

  
852 867
to rename:
......
862 877

  
863 878
COMMENT ON COLUMN taxon_match."[scrubbed_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org" IS '
864 879
derived column; = CASE
865
        WHEN matched_has_accepted THEN "[accepted_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org"
866
        ELSE "*Infraspecific_rank"
867
    END
880
    WHEN matched_has_accepted THEN "[accepted_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org"
881
    ELSE "*Infraspecific_rank"
882
END
868 883

  
869 884
to modify expr:
870
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[scrubbed_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org'')::util.col, $$CASE WHEN matched_has_accepted THEN "[accepted_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org" ELSE "*Infraspecific_rank" END$$)::util.derived_col_def);
885
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[scrubbed_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org'')::util.col, $$CASE
886
    WHEN matched_has_accepted THEN "[accepted_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org"
887
    ELSE "*Infraspecific_rank"
888
END$$)::util.derived_col_def);
871 889
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
872 890

  
873 891
to rename:
......
883 901

  
884 902
COMMENT ON COLUMN taxon_match."[scrubbed_]infraspecificEpithet__@DwC__@vegpath.org" IS '
885 903
derived column; = CASE
886
        WHEN matched_has_accepted THEN "[accepted_]specificEpithet__@DwC__@vegpath.org"
887
        ELSE "*Infraspecific_epithet_matched"
888
    END
904
    WHEN matched_has_accepted THEN "[accepted_]specificEpithet__@DwC__@vegpath.org"
905
    ELSE "*Infraspecific_epithet_matched"
906
END
889 907

  
890 908
to modify expr:
891
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[scrubbed_]infraspecificEpithet__@DwC__@vegpath.org'')::util.col, $$CASE WHEN matched_has_accepted THEN "[accepted_]specificEpithet__@DwC__@vegpath.org" ELSE "*Infraspecific_epithet_matched" END$$)::util.derived_col_def);
909
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[scrubbed_]infraspecificEpithet__@DwC__@vegpath.org'')::util.col, $$CASE
910
    WHEN matched_has_accepted THEN "[accepted_]specificEpithet__@DwC__@vegpath.org"
911
    ELSE "*Infraspecific_epithet_matched"
912
END$$)::util.derived_col_def);
892 913
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
893 914

  
894 915
to rename:
......
904 925

  
905 926
COMMENT ON COLUMN taxon_match."[scrubbed_]name[_no_author]~(-Accepted_-)__@TNRS__@vegpath.org" IS '
906 927
derived column; = CASE
907
        WHEN matched_has_accepted THEN "*Accepted_name"
908
        ELSE "*Name_matched"
909
    END
928
    WHEN matched_has_accepted THEN "*Accepted_name"
929
    ELSE "*Name_matched"
930
END
910 931

  
911 932
to modify expr:
912
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[scrubbed_]name[_no_author]~(-Accepted_-)__@TNRS__@vegpath.org'')::util.col, $$CASE WHEN matched_has_accepted THEN "*Accepted_name" ELSE "*Name_matched" END$$)::util.derived_col_def);
933
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[scrubbed_]name[_no_author]~(-Accepted_-)__@TNRS__@vegpath.org'')::util.col, $$CASE
934
    WHEN matched_has_accepted THEN "*Accepted_name"
935
    ELSE "*Name_matched"
936
END$$)::util.derived_col_def);
913 937
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
914 938

  
915 939
to rename:
......
925 949

  
926 950
COMMENT ON COLUMN taxon_match."[scrubbed_]author~(-Accepted_-)__@TNRS__@vegpath.org" IS '
927 951
derived column; = CASE
928
        WHEN matched_has_accepted THEN "*Accepted_name_author"
929
        ELSE "*Name_matched_author"
930
    END
952
    WHEN matched_has_accepted THEN "*Accepted_name_author"
953
    ELSE "*Name_matched_author"
954
END
931 955

  
932 956
to modify expr:
933
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[scrubbed_]author~(-Accepted_-)__@TNRS__@vegpath.org'')::util.col, $$CASE WHEN matched_has_accepted THEN "*Accepted_name_author" ELSE "*Name_matched_author" END$$)::util.derived_col_def);
957
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[scrubbed_]author~(-Accepted_-)__@TNRS__@vegpath.org'')::util.col, $$CASE
958
    WHEN matched_has_accepted THEN "*Accepted_name_author"
959
    ELSE "*Name_matched_author"
960
END$$)::util.derived_col_def);
934 961
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
935 962

  
936 963
to rename:
......
946 973

  
947 974
COMMENT ON COLUMN taxon_match."[scrubbed_]scientificName[_with_author]__@DwC__@vegpath.org" IS '
948 975
derived column; = CASE
949
        WHEN matched_has_accepted THEN "[accepted_]scientificName[_with_author]__@DwC__@vegpath.org"
950
        ELSE "[matched_]scientificName[_with_author]__@DwC__@vegpath.org"
951
    END
976
    WHEN matched_has_accepted THEN "[accepted_]scientificName[_with_author]__@DwC__@vegpath.org"
977
    ELSE "[matched_]scientificName[_with_author]__@DwC__@vegpath.org"
978
END
952 979

  
953 980
to modify expr:
954
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[scrubbed_]scientificName[_with_author]__@DwC__@vegpath.org'')::util.col, $$CASE WHEN matched_has_accepted THEN "[accepted_]scientificName[_with_author]__@DwC__@vegpath.org" ELSE "[matched_]scientificName[_with_author]__@DwC__@vegpath.org" END$$)::util.derived_col_def);
981
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[scrubbed_]scientificName[_with_author]__@DwC__@vegpath.org'')::util.col, $$CASE
982
    WHEN matched_has_accepted THEN "[accepted_]scientificName[_with_author]__@DwC__@vegpath.org"
983
    ELSE "[matched_]scientificName[_with_author]__@DwC__@vegpath.org"
984
END$$)::util.derived_col_def);
955 985
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
956 986

  
957 987
to rename:
trunk/schemas/util.sql
1990 1990

  
1991 1991
-- once CHECK constraint exists so that we can use its canon-ed formula
1992 1992
SELECT util.set_comment(def.col, '
1993
derived column; = '||util.derived_col_expr(def.col)||'
1993
derived column; = '||def.expr||'
1994 1994

  
1995 1995
to modify expr:
1996 1996
SELECT util.derived_col_update('||util.quote_typed(def)||');
......
2000 2000
# rename column
2001 2001
# rename CHECK constraint
2002 2002
SELECT util.derived_cols_update('||util.quote_typed((def).col.table_)||');
2003
');
2003
')
2004
FROM (SELECT util.derived_col_def(def.col)/*expr from DB*/ AS def) s
2005
;
2004 2006

  
2005 2007
SELECT util.derived_cols_trigger_update((def).col.table_);
2006 2008
$$;
trunk/schemas/vegbien.sql
19311 19311
	
19312 19312
	new."[scrubbed_]taxonRank__@DwC__@vegpath.org" = (SELECT
19313 19313
		CASE
19314
        WHEN matched_has_accepted THEN "*Accepted_name_rank"
19315
        ELSE "*Name_matched_rank"
19316
    END
19314
    WHEN matched_has_accepted THEN "*Accepted_name_rank"
19315
    ELSE "*Name_matched_rank"
19316
END
19317 19317
		FROM (SELECT new.*) new);
19318 19318
	
19319 19319
	new."[scrubbed_]family~(-Accepted_-)__@TNRS__@vegpath.org" = (SELECT
19320 19320
		CASE
19321
        WHEN matched_has_accepted THEN "*Accepted_name_family"
19322
        ELSE "*Name_matched_accepted_family"
19323
    END
19321
    WHEN matched_has_accepted THEN "*Accepted_name_family"
19322
    ELSE "*Name_matched_accepted_family"
19323
END
19324 19324
		FROM (SELECT new.*) new);
19325 19325
	
19326 19326
	new."[scrubbed_]genus__@DwC__@vegpath.org" = (SELECT
19327 19327
		CASE
19328
        WHEN matched_has_accepted THEN "[accepted_]genus__@DwC__@vegpath.org"
19329
        ELSE "*Genus_matched"
19330
    END
19328
    WHEN matched_has_accepted THEN "[accepted_]genus__@DwC__@vegpath.org"
19329
    ELSE "*Genus_matched"
19330
END
19331 19331
		FROM (SELECT new.*) new);
19332 19332
	
19333 19333
	new."[scrubbed_]specificEpithet__@DwC__@vegpath.org" = (SELECT
19334 19334
		CASE
19335
        WHEN matched_has_accepted THEN "[accepted_]specificEpithet__@DwC__@vegpath.org"
19336
        ELSE "*Specific_epithet_matched"
19337
    END
19335
    WHEN matched_has_accepted THEN "[accepted_]specificEpithet__@DwC__@vegpath.org"
19336
    ELSE "*Specific_epithet_matched"
19337
END
19338 19338
		FROM (SELECT new.*) new);
19339 19339
	
19340 19340
	new."[scrubbed_]species[_binom]~(-Accepted_-)__@TNRS__@vegpath.org" = (SELECT
19341 19341
		CASE
19342
        WHEN matched_has_accepted THEN "*Accepted_name_species"
19343
        ELSE "[matched_]species[_binomial]~(-Accepted_-)__@TNRS__@vegpath.org"
19344
    END
19342
    WHEN matched_has_accepted THEN "*Accepted_name_species"
19343
    ELSE "[matched_]species[_binomial]~(-Accepted_-)__@TNRS__@vegpath.org"
19344
END
19345 19345
		FROM (SELECT new.*) new);
19346 19346
	
19347 19347
	new."[scrubbed_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org" = (SELECT
19348 19348
		CASE
19349
        WHEN matched_has_accepted THEN "[accepted_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org"
19350
        ELSE "*Infraspecific_rank"
19351
    END
19349
    WHEN matched_has_accepted THEN "[accepted_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org"
19350
    ELSE "*Infraspecific_rank"
19351
END
19352 19352
		FROM (SELECT new.*) new);
19353 19353
	
19354 19354
	new."[scrubbed_]infraspecificEpithet__@DwC__@vegpath.org" = (SELECT
19355 19355
		CASE
19356
        WHEN matched_has_accepted THEN "[accepted_]specificEpithet__@DwC__@vegpath.org"
19357
        ELSE "*Infraspecific_epithet_matched"
19358
    END
19356
    WHEN matched_has_accepted THEN "[accepted_]specificEpithet__@DwC__@vegpath.org"
19357
    ELSE "*Infraspecific_epithet_matched"
19358
END
19359 19359
		FROM (SELECT new.*) new);
19360 19360
	
19361 19361
	new."[scrubbed_]name[_no_author]~(-Accepted_-)__@TNRS__@vegpath.org" = (SELECT
19362 19362
		CASE
19363
        WHEN matched_has_accepted THEN "*Accepted_name"
19364
        ELSE "*Name_matched"
19365
    END
19363
    WHEN matched_has_accepted THEN "*Accepted_name"
19364
    ELSE "*Name_matched"
19365
END
19366 19366
		FROM (SELECT new.*) new);
19367 19367
	
19368 19368
	new."[scrubbed_]author~(-Accepted_-)__@TNRS__@vegpath.org" = (SELECT
19369 19369
		CASE
19370
        WHEN matched_has_accepted THEN "*Accepted_name_author"
19371
        ELSE "*Name_matched_author"
19372
    END
19370
    WHEN matched_has_accepted THEN "*Accepted_name_author"
19371
    ELSE "*Name_matched_author"
19372
END
19373 19373
		FROM (SELECT new.*) new);
19374 19374
	
19375 19375
	new."[scrubbed_]scientificName[_with_author]__@DwC__@vegpath.org" = (SELECT
19376 19376
		CASE
19377
        WHEN matched_has_accepted THEN "[accepted_]scientificName[_with_author]__@DwC__@vegpath.org"
19378
        ELSE "[matched_]scientificName[_with_author]__@DwC__@vegpath.org"
19379
    END
19377
    WHEN matched_has_accepted THEN "[accepted_]scientificName[_with_author]__@DwC__@vegpath.org"
19378
    ELSE "[matched_]scientificName[_with_author]__@DwC__@vegpath.org"
19379
END
19380 19380
		FROM (SELECT new.*) new);
19381 19381
	
19382 19382
	RETURN new;
......
19673 19673
derived column; = ("*Genus_matched" || '' ''::text) || "*Specific_epithet_matched"
19674 19674

  
19675 19675
to modify expr:
19676
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[matched_]species[_binomial]~(-Accepted_-)__@TNRS__@vegpath.org'')::util.col, $$"*Genus_matched" || '' ''::text || "*Specific_epithet_matched"$$)::util.derived_col_def);
19676
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[matched_]species[_binomial]~(-Accepted_-)__@TNRS__@vegpath.org'')::util.col, $$("*Genus_matched" || '' ''::text) || "*Specific_epithet_matched"$$)::util.derived_col_def);
19677 19677
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
19678 19678

  
19679 19679
to rename:
......
19869 19869

  
19870 19870
COMMENT ON COLUMN taxon_match."[scrubbed_]taxonRank__@DwC__@vegpath.org" IS '
19871 19871
derived column; = CASE
19872
        WHEN matched_has_accepted THEN "*Accepted_name_rank"
19873
        ELSE "*Name_matched_rank"
19874
    END
19872
    WHEN matched_has_accepted THEN "*Accepted_name_rank"
19873
    ELSE "*Name_matched_rank"
19874
END
19875 19875

  
19876 19876
to modify expr:
19877
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[scrubbed_]taxonRank__@DwC__@vegpath.org'')::util.col, $$CASE WHEN matched_has_accepted THEN "*Accepted_name_rank" ELSE "*Name_matched_rank" END$$)::util.derived_col_def);
19877
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[scrubbed_]taxonRank__@DwC__@vegpath.org'')::util.col, $$CASE
19878
    WHEN matched_has_accepted THEN "*Accepted_name_rank"
19879
    ELSE "*Name_matched_rank"
19880
END$$)::util.derived_col_def);
19878 19881
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
19879 19882

  
19880 19883
to rename:
......
19890 19893

  
19891 19894
COMMENT ON COLUMN taxon_match."[scrubbed_]family~(-Accepted_-)__@TNRS__@vegpath.org" IS '
19892 19895
derived column; = CASE
19893
        WHEN matched_has_accepted THEN "*Accepted_name_family"
19894
        ELSE "*Name_matched_accepted_family"
19895
    END
19896
    WHEN matched_has_accepted THEN "*Accepted_name_family"
19897
    ELSE "*Name_matched_accepted_family"
19898
END
19896 19899

  
19897 19900
to modify expr:
19898
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[scrubbed_]family~(-Accepted_-)__@TNRS__@vegpath.org'')::util.col, $$CASE WHEN matched_has_accepted THEN "*Accepted_name_family" ELSE "*Name_matched_accepted_family" END$$)::util.derived_col_def);
19901
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[scrubbed_]family~(-Accepted_-)__@TNRS__@vegpath.org'')::util.col, $$CASE
19902
    WHEN matched_has_accepted THEN "*Accepted_name_family"
19903
    ELSE "*Name_matched_accepted_family"
19904
END$$)::util.derived_col_def);
19899 19905
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
19900 19906

  
19901 19907
to rename:
......
19911 19917

  
19912 19918
COMMENT ON COLUMN taxon_match."[scrubbed_]genus__@DwC__@vegpath.org" IS '
19913 19919
derived column; = CASE
19914
        WHEN matched_has_accepted THEN "[accepted_]genus__@DwC__@vegpath.org"
19915
        ELSE "*Genus_matched"
19916
    END
19920
    WHEN matched_has_accepted THEN "[accepted_]genus__@DwC__@vegpath.org"
19921
    ELSE "*Genus_matched"
19922
END
19917 19923

  
19918 19924
to modify expr:
19919
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[scrubbed_]genus__@DwC__@vegpath.org'')::util.col, $$CASE WHEN matched_has_accepted THEN "[accepted_]genus__@DwC__@vegpath.org" ELSE "*Genus_matched" END$$)::util.derived_col_def);
19925
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[scrubbed_]genus__@DwC__@vegpath.org'')::util.col, $$CASE
19926
    WHEN matched_has_accepted THEN "[accepted_]genus__@DwC__@vegpath.org"
19927
    ELSE "*Genus_matched"
19928
END$$)::util.derived_col_def);
19920 19929
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
19921 19930

  
19922 19931
to rename:
......
19932 19941

  
19933 19942
COMMENT ON COLUMN taxon_match."[scrubbed_]specificEpithet__@DwC__@vegpath.org" IS '
19934 19943
derived column; = CASE
19935
        WHEN matched_has_accepted THEN "[accepted_]specificEpithet__@DwC__@vegpath.org"
19936
        ELSE "*Specific_epithet_matched"
19937
    END
19944
    WHEN matched_has_accepted THEN "[accepted_]specificEpithet__@DwC__@vegpath.org"
19945
    ELSE "*Specific_epithet_matched"
19946
END
19938 19947

  
19939 19948
to modify expr:
19940
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[scrubbed_]specificEpithet__@DwC__@vegpath.org'')::util.col, $$CASE WHEN matched_has_accepted THEN "[accepted_]specificEpithet__@DwC__@vegpath.org" ELSE "*Specific_epithet_matched" END$$)::util.derived_col_def);
19949
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[scrubbed_]specificEpithet__@DwC__@vegpath.org'')::util.col, $$CASE
19950
    WHEN matched_has_accepted THEN "[accepted_]specificEpithet__@DwC__@vegpath.org"
19951
    ELSE "*Specific_epithet_matched"
19952
END$$)::util.derived_col_def);
19941 19953
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
19942 19954

  
19943 19955
to rename:
......
19953 19965

  
19954 19966
COMMENT ON COLUMN taxon_match."[scrubbed_]species[_binom]~(-Accepted_-)__@TNRS__@vegpath.org" IS '
19955 19967
derived column; = CASE
19956
        WHEN matched_has_accepted THEN "*Accepted_name_species"
19957
        ELSE "[matched_]species[_binomial]~(-Accepted_-)__@TNRS__@vegpath.org"
19958
    END
19968
    WHEN matched_has_accepted THEN "*Accepted_name_species"
19969
    ELSE "[matched_]species[_binomial]~(-Accepted_-)__@TNRS__@vegpath.org"
19970
END
19959 19971

  
19960 19972
to modify expr:
19961
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[scrubbed_]species[_binom]~(-Accepted_-)__@TNRS__@vegpath.org'')::util.col, $$CASE WHEN matched_has_accepted THEN "*Accepted_name_species" ELSE "[matched_]species[_binomial]~(-Accepted_-)__@TNRS__@vegpath.org" END$$)::util.derived_col_def);
19973
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[scrubbed_]species[_binom]~(-Accepted_-)__@TNRS__@vegpath.org'')::util.col, $$CASE
19974
    WHEN matched_has_accepted THEN "*Accepted_name_species"
19975
    ELSE "[matched_]species[_binomial]~(-Accepted_-)__@TNRS__@vegpath.org"
19976
END$$)::util.derived_col_def);
19962 19977
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
19963 19978

  
19964 19979
to rename:
......
19974 19989

  
19975 19990
COMMENT ON COLUMN taxon_match."[scrubbed_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org" IS '
19976 19991
derived column; = CASE
19977
        WHEN matched_has_accepted THEN "[accepted_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org"
19978
        ELSE "*Infraspecific_rank"
19979
    END
19992
    WHEN matched_has_accepted THEN "[accepted_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org"
19993
    ELSE "*Infraspecific_rank"
19994
END
19980 19995

  
19981 19996
to modify expr:
19982
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[scrubbed_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org'')::util.col, $$CASE WHEN matched_has_accepted THEN "[accepted_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org" ELSE "*Infraspecific_rank" END$$)::util.derived_col_def);
19997
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[scrubbed_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org'')::util.col, $$CASE
19998
    WHEN matched_has_accepted THEN "[accepted_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org"
19999
    ELSE "*Infraspecific_rank"
20000
END$$)::util.derived_col_def);
19983 20001
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
19984 20002

  
19985 20003
to rename:
......
19995 20013

  
19996 20014
COMMENT ON COLUMN taxon_match."[scrubbed_]infraspecificEpithet__@DwC__@vegpath.org" IS '
19997 20015
derived column; = CASE
19998
        WHEN matched_has_accepted THEN "[accepted_]specificEpithet__@DwC__@vegpath.org"
19999
        ELSE "*Infraspecific_epithet_matched"
20000
    END
20016
    WHEN matched_has_accepted THEN "[accepted_]specificEpithet__@DwC__@vegpath.org"
20017
    ELSE "*Infraspecific_epithet_matched"
20018
END
20001 20019

  
20002 20020
to modify expr:
20003
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[scrubbed_]infraspecificEpithet__@DwC__@vegpath.org'')::util.col, $$CASE WHEN matched_has_accepted THEN "[accepted_]specificEpithet__@DwC__@vegpath.org" ELSE "*Infraspecific_epithet_matched" END$$)::util.derived_col_def);
20021
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[scrubbed_]infraspecificEpithet__@DwC__@vegpath.org'')::util.col, $$CASE
20022
    WHEN matched_has_accepted THEN "[accepted_]specificEpithet__@DwC__@vegpath.org"
20023
    ELSE "*Infraspecific_epithet_matched"
20024
END$$)::util.derived_col_def);
20004 20025
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
20005 20026

  
20006 20027
to rename:
......
20016 20037

  
20017 20038
COMMENT ON COLUMN taxon_match."[scrubbed_]name[_no_author]~(-Accepted_-)__@TNRS__@vegpath.org" IS '
20018 20039
derived column; = CASE
20019
        WHEN matched_has_accepted THEN "*Accepted_name"
20020
        ELSE "*Name_matched"
20021
    END
20040
    WHEN matched_has_accepted THEN "*Accepted_name"
20041
    ELSE "*Name_matched"
20042
END
20022 20043

  
20023 20044
to modify expr:
20024
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[scrubbed_]name[_no_author]~(-Accepted_-)__@TNRS__@vegpath.org'')::util.col, $$CASE WHEN matched_has_accepted THEN "*Accepted_name" ELSE "*Name_matched" END$$)::util.derived_col_def);
20045
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[scrubbed_]name[_no_author]~(-Accepted_-)__@TNRS__@vegpath.org'')::util.col, $$CASE
20046
    WHEN matched_has_accepted THEN "*Accepted_name"
20047
    ELSE "*Name_matched"
20048
END$$)::util.derived_col_def);
20025 20049
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
20026 20050

  
20027 20051
to rename:
......
20037 20061

  
20038 20062
COMMENT ON COLUMN taxon_match."[scrubbed_]author~(-Accepted_-)__@TNRS__@vegpath.org" IS '
20039 20063
derived column; = CASE
20040
        WHEN matched_has_accepted THEN "*Accepted_name_author"
20041
        ELSE "*Name_matched_author"
20042
    END
20064
    WHEN matched_has_accepted THEN "*Accepted_name_author"
20065
    ELSE "*Name_matched_author"
20066
END
20043 20067

  
20044 20068
to modify expr:
20045
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[scrubbed_]author~(-Accepted_-)__@TNRS__@vegpath.org'')::util.col, $$CASE WHEN matched_has_accepted THEN "*Accepted_name_author" ELSE "*Name_matched_author" END$$)::util.derived_col_def);
20069
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[scrubbed_]author~(-Accepted_-)__@TNRS__@vegpath.org'')::util.col, $$CASE
20070
    WHEN matched_has_accepted THEN "*Accepted_name_author"
20071
    ELSE "*Name_matched_author"
20072
END$$)::util.derived_col_def);
20046 20073
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
20047 20074

  
20048 20075
to rename:
......
20058 20085

  
20059 20086
COMMENT ON COLUMN taxon_match."[scrubbed_]scientificName[_with_author]__@DwC__@vegpath.org" IS '
20060 20087
derived column; = CASE
20061
        WHEN matched_has_accepted THEN "[accepted_]scientificName[_with_author]__@DwC__@vegpath.org"
20062
        ELSE "[matched_]scientificName[_with_author]__@DwC__@vegpath.org"
20063
    END
20088
    WHEN matched_has_accepted THEN "[accepted_]scientificName[_with_author]__@DwC__@vegpath.org"
20089
    ELSE "[matched_]scientificName[_with_author]__@DwC__@vegpath.org"
20090
END
20064 20091

  
20065 20092
to modify expr:
20066
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[scrubbed_]scientificName[_with_author]__@DwC__@vegpath.org'')::util.col, $$CASE WHEN matched_has_accepted THEN "[accepted_]scientificName[_with_author]__@DwC__@vegpath.org" ELSE "[matched_]scientificName[_with_author]__@DwC__@vegpath.org" END$$)::util.derived_col_def);
20093
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[scrubbed_]scientificName[_with_author]__@DwC__@vegpath.org'')::util.col, $$CASE
20094
    WHEN matched_has_accepted THEN "[accepted_]scientificName[_with_author]__@DwC__@vegpath.org"
20095
    ELSE "[matched_]scientificName[_with_author]__@DwC__@vegpath.org"
20096
END$$)::util.derived_col_def);
20067 20097
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
20068 20098

  
20069 20099
to rename:

Also available in: Unified diff