bety
bety copied to clipboard
orphaned treatments?
This search shows that there treatment_ids 1-10 exist in management_treatments, but 2-10 do not have referents in traits or yields.
select distinct treatment_id from managements_treatments order by treatment_id limit 10
select distinct treatment_id from yields order by treatment_id limit 10
select distinct treatment_id from managements_treatments order by treatment_id limit 10
select distinct treatment_id from traits_and_yields_view_private order by treatment_id limit 10
But if I try to identify treatment_ids that exist in managments_treatments
but not in other tables,
select treatment_id from managements_treatments where treatment_id not in (select distinct treatment_id from traits_and_yields_view_private)
select treatment_id from managements_treatments where treatment_id not in (select distinct treatment_id from traits_and_yields_view_private)
select treatment_id from managements_treatments where treatment_id not in (select distinct id from treatments)
I tried disabling constraints but that did not help.
alter table managements disable trigger all
alter table treatments disable trigger all
alter table managements_treatments disable trigger all
alter table yields disable trigger all
alter table traits disable trigger all