Project

General

Profile

« Previous | Next » 

Revision 5517

schemas/vegbien.sql: taxonconcept: taxonconcept_2_propagate_accepted_concept_id(): Also update accepted_concept_id on concepts that resolve to this concept, which may have been created before this concept was marked as accepted if concepts are not imported in dependency order (accepted concepts first). Added index on matched_concept_id to speed up finding concepts that resolve to this concept.

View differences:

schemas/vegbien.my.sql
3985 3985

  
3986 3986

  
3987 3987
--
3988
-- Name: taxonconcept_matched_concept_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
3989
--
3990

  
3991
CREATE INDEX taxonconcept_matched_concept_id_idx ON taxonconcept  (matched_concept_id);
3992

  
3993

  
3994
--
3988 3995
-- Name: taxonconcept_unique; Type: INDEX; Schema: public; Owner: -; Tablespace: 
3989 3996
--
3990 3997

  
schemas/vegbien.sql
458 458
                WHERE taxonconcept_id = new.matched_concept_id
459 459
            );
460 460
        END IF;
461
        
462
        -- Update accepted_concept_id on concepts that resolve to this concept
463
        UPDATE taxonconcept
464
        SET accepted_concept_id = new.accepted_concept_id
465
        WHERE matched_concept_id = new.taxonconcept_id
466
        AND taxonconcept_id != new.taxonconcept_id -- avoid infinite recursion
467
        ;
461 468
    END IF;
462 469
    RETURN new;
463 470
END;
......
4678 4685

  
4679 4686

  
4680 4687
--
4688
-- Name: taxonconcept_matched_concept_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4689
--
4690

  
4691
CREATE INDEX taxonconcept_matched_concept_id_idx ON taxonconcept USING btree (matched_concept_id);
4692

  
4693

  
4694
--
4681 4695
-- Name: taxonconcept_unique; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4682 4696
--
4683 4697

  

Also available in: Unified diff