Project

General

Profile

« Previous | Next » 

Revision 1560

vegbien.sql: Fixed bug in tree cross-link algorithm where recursion to descendants' ancestors did not use new to refer to the current node's plantname_id

View differences:

schemas/tree_cross-links.sql
36 36
    -- Tell immediate children to update their ancestors lists, which will
37 37
    -- recursively tell all descendants
38 38
    UPDATE plantname
39
    SET plantname_id = plantname.plantname_id -- set to itself
40
    WHERE parent_id = plantname_id -- the plantname_id passed as param
39
    SET plantname_id = plantname_id -- need at least one SET statement
40
    WHERE parent_id = new.plantname_id -- the plantname_id passed as param
41 41
    ;
42 42
    
43 43
    /* Note: We don't need an ON DELETE trigger to update the descendants'
schemas/vegbien.sql
235 235
    -- Tell immediate children to update their ancestors lists, which will
236 236
    -- recursively tell all descendants
237 237
    UPDATE namedplace
238
    SET namedplace_id = namedplace.namedplace_id -- set to itself
239
    WHERE parent_id = namedplace_id -- the namedplace_id passed as param
238
    SET namedplace_id = namedplace_id -- need at least one SET statement
239
    WHERE parent_id = new.namedplace_id -- the namedplace_id passed as param
240 240
    ;
241 241
    
242 242
    /* Note: We don't need an ON DELETE trigger to update the descendants'
......
285 285
    -- Tell immediate children to update their ancestors lists, which will
286 286
    -- recursively tell all descendants
287 287
    UPDATE plantname
288
    SET plantname_id = plantname.plantname_id -- set to itself
289
    WHERE parent_id = plantname_id -- the plantname_id passed as param
288
    SET plantname_id = plantname_id -- need at least one SET statement
289
    WHERE parent_id = new.plantname_id -- the plantname_id passed as param
290 290
    ;
291 291
    
292 292
    /* Note: We don't need an ON DELETE trigger to update the descendants'

Also available in: Unified diff