/* Prevent "cannot alter type of a column used by a view or rule" errors when cleanup operations are run using in place UPDATE */ DROP VIEW IF EXISTS view_all_commnames_code CASCADE; DROP VIEW IF EXISTS view_all_commnames_common CASCADE; DROP VIEW IF EXISTS view_all_commnames_sciname CASCADE; DROP VIEW IF EXISTS view_all_commnames_translated CASCADE; DROP VIEW IF EXISTS view_all_plantnames_code CASCADE; DROP VIEW IF EXISTS view_all_plantnames_common CASCADE; DROP VIEW IF EXISTS view_all_plantnames_sciname CASCADE; DROP VIEW IF EXISTS view_all_plantnames_scinamenoauth CASCADE; DROP VIEW IF EXISTS view_notemb_observation CASCADE; DROP VIEW IF EXISTS view_browseparty_classcontrib CASCADE; DROP VIEW IF EXISTS view_browseparty_obscontrib CASCADE; DROP VIEW IF EXISTS view_browseparty_projectcontrib CASCADE; DROP VIEW IF EXISTS view_browseparty_all CASCADE; DROP VIEW IF EXISTS view_browseparty_all_count CASCADE; DROP VIEW IF EXISTS view_browseparty_classcontrib_count CASCADE; DROP VIEW IF EXISTS view_browseparty_obscontrib_count CASCADE; DROP VIEW IF EXISTS view_browseparty_projectcontrib_count CASCADE; DROP VIEW IF EXISTS view_browseparty_all_count_combined CASCADE; DROP VIEW IF EXISTS view_busrule_duplcovercode CASCADE; DROP VIEW IF EXISTS view_busrule_duplstratumtype CASCADE; DROP VIEW IF EXISTS view_busrule_plotsizeshape CASCADE; DROP VIEW IF EXISTS view_reference_transl CASCADE; DROP VIEW IF EXISTS view_commconcept_transl CASCADE; DROP VIEW IF EXISTS view_notemb_commclass CASCADE; DROP VIEW IF EXISTS view_comminterp_more CASCADE; DROP VIEW IF EXISTS view_csv_taxonimportance_pre CASCADE; DROP VIEW IF EXISTS view_csv_taxonimportance CASCADE; DROP VIEW IF EXISTS view_dbafielddesc_notimpl CASCADE; DROP VIEW IF EXISTS view_emb_embargo_currentfullonly CASCADE; DROP VIEW IF EXISTS view_emb_embargo_complete CASCADE; DROP VIEW IF EXISTS view_keywprojplaces CASCADE; DROP VIEW IF EXISTS view_kwhelper_projcontrib CASCADE; DROP VIEW IF EXISTS view_kwhelper_refjournal CASCADE; DROP VIEW IF EXISTS view_kwhelper_refparty CASCADE; DROP VIEW IF EXISTS view_notemb_classcontributor CASCADE; DROP VIEW IF EXISTS view_notemb_comminterpretation CASCADE; DROP VIEW IF EXISTS view_notemb_disturbanceobs CASCADE; DROP VIEW IF EXISTS view_notemb_plot CASCADE; DROP VIEW IF EXISTS view_notemb_soilobs CASCADE; DROP VIEW IF EXISTS view_notemb_stemcount CASCADE; DROP VIEW IF EXISTS view_notemb_stemlocation CASCADE; DROP VIEW IF EXISTS view_notemb_taxonalt CASCADE; DROP VIEW IF EXISTS view_notemb_taxonimportance CASCADE; DROP VIEW IF EXISTS view_notemb_taxoninterpretation CASCADE; DROP VIEW IF EXISTS view_notemb_taxonobservation CASCADE; DROP VIEW IF EXISTS view_observation_transl CASCADE; DROP VIEW IF EXISTS view_party_public CASCADE; DROP VIEW IF EXISTS view_party_transl CASCADE; DROP VIEW IF EXISTS view_plantconcept_transl CASCADE; DROP VIEW IF EXISTS view_plotall_withembargo CASCADE; DROP VIEW IF EXISTS view_std_commnames_code CASCADE; DROP VIEW IF EXISTS view_std_commnames_common CASCADE; DROP VIEW IF EXISTS view_std_commnames_sciname CASCADE; DROP VIEW IF EXISTS view_std_commnames_translated CASCADE; DROP VIEW IF EXISTS view_std_plantnames_code CASCADE; DROP VIEW IF EXISTS view_std_plantnames_common CASCADE; DROP VIEW IF EXISTS view_std_plantnames_sciname CASCADE; DROP VIEW IF EXISTS view_std_plantnames_scinamenoauth CASCADE; DROP VIEW IF EXISTS view_taxoninterp_more CASCADE; DROP VIEW IF EXISTS view_taxonobs_withmaxcover CASCADE; DROP VIEW IF EXISTS view_taxonobs_distinctid_curr CASCADE; DROP VIEW IF EXISTS view_taxonobs_distinctid_curr_counts CASCADE; DROP VIEW IF EXISTS view_taxonobs_distinctid_curr_counts_plants CASCADE; -- Prevent "column name specified more than once" errors when tables are joined ALTER TABLE taxonobservation RENAME reference_id TO taxonobservation_reference_id; ALTER TABLE taxonobservation RENAME accessioncode TO taxonobservation_accessioncode; ALTER TABLE taxoninterpretation RENAME plantname_id TO taxoninterpretation_plantname_id; ALTER TABLE taxoninterpretation RENAME accessioncode TO taxoninterpretation_accessioncode; ALTER TABLE plantconcept RENAME reference_id TO plantconcept_reference_id; ALTER TABLE plantconcept RENAME accessioncode TO plantconcept_accessioncode;