select *
from ag.source_barcodes_surveys
join ag.ag_login_surveys using (survey_id)
join ag.ag_consent using (ag_login_id, participant_name)
where barcode='foo';
This query needs to be expanded to touch ag_kit and ag_login to recreate the type of result from get_ag_barcode_details
A more accurate base query can be formed with:
This query needs to be expanded to touch
ag_kit
andag_login
to recreate the type of result fromget_ag_barcode_details