Revision 12015
Added by Aaron Marcuse-Kubitza almost 11 years ago
trunk/schemas/vegbien.sql | ||
---|---|---|
829 | 829 |
LANGUAGE plpgsql |
830 | 830 |
AS $$ |
831 | 831 |
BEGIN |
832 |
new.top_plot = COALESCE( |
|
833 |
(SELECT top_plot FROM location WHERE location_id = new.parent_id), |
|
834 |
new.location_id); |
|
832 |
new.top_plot = (CASE WHEN new.parent_id IS NULL |
|
833 |
THEN new.location_id |
|
834 |
ELSE (SELECT top_plot FROM location WHERE location_id = new.parent_id) |
|
835 |
END); |
|
835 | 836 |
RETURN new; |
836 | 837 |
END; |
837 | 838 |
$$; |
Also available in: Unified diff
schemas/vegbien.sql: location_set_top_plot(): only do the lookup of the parent's top_plot when there is a parent_id