Revision 5034
Added by Aaron Marcuse-Kubitza over 12 years ago
vegbien.sql | ||
---|---|---|
316 | 316 |
LANGUAGE plpgsql |
317 | 317 |
AS $$ |
318 | 318 |
BEGIN |
319 |
IF new.placepath_id IS NULL THEN -- prepopulate placepath_id |
|
320 |
new.placepath_id = nextval('placepath_placepath_id_seq'::regclass); |
|
321 |
END IF; |
|
319 | 322 |
IF new.canon_placepath_id = 0 THEN -- make self-reference |
320 |
new.placepath_id = nextval('placepath_placepath_id_seq'::regclass); |
|
321 | 323 |
new.canon_placepath_id = new.placepath_id; |
322 | 324 |
END IF; |
323 | 325 |
RETURN new; |
... | ... | |
401 | 403 |
LANGUAGE plpgsql |
402 | 404 |
AS $$ |
403 | 405 |
BEGIN |
406 |
IF new.taxonpath_id IS NULL THEN -- prepopulate taxonpath_id |
|
407 |
new.taxonpath_id = nextval('taxonpath_taxonpath_id_seq'::regclass); |
|
408 |
END IF; |
|
404 | 409 |
IF new.canon_taxonpath_id = 0 THEN -- make self-reference |
405 |
new.taxonpath_id = nextval('taxonpath_taxonpath_id_seq'::regclass); |
|
406 | 410 |
new.canon_taxonpath_id = new.taxonpath_id; |
407 | 411 |
END IF; |
408 | 412 |
RETURN new; |
Also available in: Unified diff
schemas/vegbien.sql: taxonpath_canon_taxonpath_id_self_ref(), placepath_canon_placepath_id_self_ref(): Fixed bug where the pkey could only be prepopulated if it was not already set, in order to support UPDATE as well as INSERT statements