SELECT util.search_path_append('util');

SELECT force_update_view('"occurrence_all"', $$
SELECT "*TREE-row_num" AS "occurrence_all-row_num", *
/* directional joins ensure that the PostgreSQL query planner always joins
starting with the TREE table */
FROM               ("REF_RESEARCH_STATION"
NATURAL RIGHT JOIN ("REF_UNIT"
NATURAL RIGHT JOIN ("COUNTY"
NATURAL RIGHT JOIN ("PLOT"
NATURAL RIGHT JOIN ("COND"
	NATURAL LEFT JOIN "REF_HABTYP_DESCRIPTION"
NATURAL RIGHT JOIN ("SUBPLOT"
NATURAL RIGHT JOIN ("TREE"
	NATURAL LEFT JOIN "REF_SPECIES"
	NATURAL LEFT JOIN "REF_PLANT_DICTIONARY"
)))))))
$$);

SELECT mk_subset_by_row_num_func('"occurrence_all"', 'occurrence_all-row_num');
