         $_$;
 
 
---
--- Name: category_insert_function(); Type: FUNCTION; Schema: ctgov_beta; Owner: -
---
-
-CREATE FUNCTION ctgov_beta.category_insert_function() RETURNS trigger
-    LANGUAGE plpgsql
-    AS $$
-        BEGIN
-          INSERT INTO ctgov_beta.search_results (id, nct_id, name, created_at, updated_at, grouping, study_search_id)
-
-          VALUES (NEW.id, NEW.nct_id, NEW.name, NEW.created_at, NEW.updated_at, NEW.grouping, NEW.study_search_id);
-          RETURN NEW;
-        END;
-        $$;
-
-
---
--- Name: count_estimate(text); Type: FUNCTION; Schema: ctgov_beta; Owner: -
---
-
-CREATE FUNCTION ctgov_beta.count_estimate(query text) RETURNS integer
-    LANGUAGE plpgsql
-    AS $$
-      DECLARE
-        rec   record;
-        ROWS  INTEGER;
-      BEGIN
-        FOR rec IN EXECUTE 'EXPLAIN ' || query LOOP
-          ROWS := SUBSTRING(rec."QUERY PLAN" FROM ' rows=([[:digit:]]+)');
-          EXIT WHEN ROWS IS NOT NULL;
-      END LOOP;
-
-      RETURN ROWS;
-      END
-      $$;
-
-
---
--- Name: ids_for_org(character varying); Type: FUNCTION; Schema: ctgov_beta; Owner: -
---
-
-CREATE FUNCTION ctgov_beta.ids_for_org(character varying) RETURNS TABLE(nct_id character varying)
-    LANGUAGE sql
-    AS $_$
-      SELECT DISTINCT nct_id FROM responsible_parties WHERE lower(affiliation) like lower($1)
-      UNION
-      SELECT DISTINCT nct_id FROM facilities WHERE lower(name) like lower($1) or lower(city) like lower($1) or lower(state) like lower($1) or lower(country) like lower($1)
-      UNION
-      SELECT DISTINCT nct_id FROM sponsors WHERE lower(name) like lower($1)
-      UNION
-      SELECT DISTINCT nct_id FROM result_contacts WHERE lower(organization) like lower($1)
-      ;
-      $_$;
-
-
---
--- Name: ids_for_term(character varying); Type: FUNCTION; Schema: ctgov_beta; Owner: -
---
-
-CREATE FUNCTION ctgov_beta.ids_for_term(character varying) RETURNS TABLE(nct_id character varying)
-    LANGUAGE sql
-    AS $_$
-        SELECT DISTINCT nct_id FROM browse_conditions WHERE downcase_mesh_term like lower($1)
-        UNION
-        SELECT DISTINCT nct_id FROM browse_interventions WHERE downcase_mesh_term like lower($1)
-        UNION
-        SELECT DISTINCT nct_id FROM studies WHERE lower(brief_title) like lower($1)
-        UNION
-        SELECT DISTINCT nct_id FROM keywords WHERE lower(name) like lower($1)
-        ;
-        $_$;
-
-
---
--- Name: study_summaries_for_condition(character varying); Type: FUNCTION; Schema: ctgov_beta; Owner: -
---
-
-CREATE FUNCTION ctgov_beta.study_summaries_for_condition(character varying) RETURNS TABLE(nct_id character varying, title text, recruitment character varying, were_results_reported boolean, conditions text, interventions text, gender character varying, age text, phase character varying, enrollment integer, study_type character varying, sponsors text, other_ids text, study_first_submitted_date date, start_date date, completion_month_year character varying, last_update_submitted_date date, verification_month_year character varying, results_first_submitted_date date, acronym character varying, primary_completion_month_year character varying, outcome_measures text, disposition_first_submitted_date date, allocation character varying, intervention_model character varying, observational_model character varying, primary_purpose character varying, time_perspective character varying, masking character varying, masking_description text, intervention_model_description text, subject_masked boolean, caregiver_masked boolean, investigator_masked boolean, outcomes_assessor_masked boolean, number_of_facilities integer)
-    LANGUAGE sql
-    AS $_$
-      SELECT DISTINCT s.nct_id,
-          s.brief_title,
-          s.overall_status,
-          cv.were_results_reported,
-          bc.mesh_term,
-          i.names as interventions,
-          e.gender,
-          CASE
-            WHEN e.minimum_age = 'N/A' AND e.maximum_age = 'N/A' THEN 'No age restriction'
-            WHEN e.minimum_age != 'N/A' AND e.maximum_age = 'N/A' THEN concat(e.minimum_age, ' and older')
-            WHEN e.minimum_age = 'N/A' AND e.maximum_age != 'N/A' THEN concat('up to ', e.maximum_age)
-            ELSE concat(e.minimum_age, ' to ', e.maximum_age)
-          END,
-          CASE
-            WHEN s.phase='N/A' THEN NULL
-            ELSE s.phase
-          END,
-          s.enrollment,
-          s.study_type,
-          sp.names as sponsors,
-          id.names as id_values,
-          s.study_first_submitted_date,
-          s.start_date,
-          s.completion_month_year,
-          s.last_update_submitted_date,
-          s.verification_month_year,
-          s.results_first_submitted_date,
-          s.acronym,
-          s.primary_completion_month_year,
-          o.names as design_outcomes,
-          s.disposition_first_submitted_date,
-          d.allocation,
-          d.intervention_model,
-          d.observational_model,
-          d.primary_purpose,
-          d.time_perspective,
-          d.masking,
-          d.masking_description,
-          d.intervention_model_description,
-          d.subject_masked,
-          d.caregiver_masked,
-          d.investigator_masked,
-          d.outcomes_assessor_masked,
-          cv.number_of_facilities
-      FROM studies s
-        INNER JOIN browse_conditions         bc ON s.nct_id = bc.nct_id and bc.downcase_mesh_term  like lower($1)
-        LEFT OUTER JOIN calculated_values    cv ON s.nct_id = cv.nct_id
-        LEFT OUTER JOIN all_conditions       c  ON s.nct_id = c.nct_id
-        LEFT OUTER JOIN all_interventions    i  ON s.nct_id = i.nct_id
-        LEFT OUTER JOIN all_sponsors         sp ON s.nct_id = sp.nct_id
-        LEFT OUTER JOIN eligibilities        e  ON s.nct_id = e.nct_id
-        LEFT OUTER JOIN all_id_information   id ON s.nct_id = id.nct_id
-        LEFT OUTER JOIN all_design_outcomes  o  ON s.nct_id = o.nct_id
-        LEFT OUTER JOIN designs              d  ON s.nct_id = d.nct_id
-     UNION
-      SELECT DISTINCT s.nct_id,
-          s.brief_title,
-          s.overall_status,
-          cv.were_results_reported,
-          bc.name,
-          i.names as interventions,
-          e.gender,
-          CASE
-            WHEN e.minimum_age = 'N/A' AND e.maximum_age = 'N/A' THEN 'No age restriction'
-            WHEN e.minimum_age != 'N/A' AND e.maximum_age = 'N/A' THEN concat(e.minimum_age, ' and older')
-            WHEN e.minimum_age = 'N/A' AND e.maximum_age != 'N/A' THEN concat('up to ', e.maximum_age)
-            ELSE concat(e.minimum_age, ' to ', e.maximum_age)
-          END,
-          CASE
-            WHEN s.phase='N/A' THEN NULL
-            ELSE s.phase
-          END,
-          s.enrollment,
-          s.study_type,
-          sp.names as sponsors,
-          id.names as id_values,
-          s.study_first_submitted_date,
-          s.start_date,
-          s.completion_month_year,
-          s.last_update_submitted_date,
-          s.verification_month_year,
-          s.results_first_submitted_date,
-          s.acronym,
-          s.primary_completion_month_year,
-          o.names as design_outcomes,
-          s.disposition_first_submitted_date,
-          d.allocation,
-          d.intervention_model,
-          d.observational_model,
-          d.primary_purpose,
-          d.time_perspective,
-          d.masking,
-          d.masking_description,
-          d.intervention_model_description,
-          d.subject_masked,
-          d.caregiver_masked,
-          d.investigator_masked,
-          d.outcomes_assessor_masked,
-          cv.number_of_facilities
-      FROM studies s
-        INNER JOIN conditions                bc ON s.nct_id = bc.nct_id and bc.downcase_name like lower($1)
-        LEFT OUTER JOIN calculated_values    cv ON s.nct_id = cv.nct_id
-        LEFT OUTER JOIN all_conditions       c  ON s.nct_id = c.nct_id
-        LEFT OUTER JOIN all_interventions    i  ON s.nct_id = i.nct_id
-        LEFT OUTER JOIN all_sponsors         sp ON s.nct_id = sp.nct_id
-        LEFT OUTER JOIN eligibilities        e  ON s.nct_id = e.nct_id
-        LEFT OUTER JOIN all_id_information   id ON s.nct_id = id.nct_id
-        LEFT OUTER JOIN all_design_outcomes  o  ON s.nct_id = o.nct_id
-        LEFT OUTER JOIN designs              d  ON s.nct_id = d.nct_id
-     UNION
-      SELECT DISTINCT s.nct_id,
-          s.brief_title,
-          s.overall_status,
-          cv.were_results_reported,
-          k.name,
-          i.names as interventions,
-          e.gender,
-          CASE
-            WHEN e.minimum_age = 'N/A' AND e.maximum_age = 'N/A' THEN 'No age restriction'
-            WHEN e.minimum_age != 'N/A' AND e.maximum_age = 'N/A' THEN concat(e.minimum_age, ' and older')
-            WHEN e.minimum_age = 'N/A' AND e.maximum_age != 'N/A' THEN concat('up to ', e.maximum_age)
-            ELSE concat(e.minimum_age, ' to ', e.maximum_age)
-          END,
-          CASE
-            WHEN s.phase='N/A' THEN NULL
-            ELSE s.phase
-          END,
-          s.enrollment,
-          s.study_type,
-          sp.names as sponsors,
-          id.names as id_values,
-          s.study_first_submitted_date,
-          s.start_date,
-          s.completion_month_year,
-          s.last_update_submitted_date,
-          s.verification_month_year,
-          s.results_first_submitted_date,
-          s.acronym,
-          s.primary_completion_month_year,
-          o.names as outcome_measures,
-          s.disposition_first_submitted_date,
-          d.allocation,
-          d.intervention_model,
-          d.observational_model,
-          d.primary_purpose,
-          d.time_perspective,
-          d.masking,
-          d.masking_description,
-          d.intervention_model_description,
-          d.subject_masked,
-          d.caregiver_masked,
-          d.investigator_masked,
-          d.outcomes_assessor_masked,
-          cv.number_of_facilities
-      FROM studies s
-        INNER JOIN keywords k ON s.nct_id = k.nct_id and k.downcase_name like lower($1)
-        LEFT OUTER JOIN calculated_values   cv ON s.nct_id = cv.nct_id
-        LEFT OUTER JOIN all_conditions      c  ON s.nct_id = c.nct_id
-        LEFT OUTER JOIN all_interventions   i  ON s.nct_id = i.nct_id
-        LEFT OUTER JOIN all_sponsors        sp ON s.nct_id = sp.nct_id
-        LEFT OUTER JOIN eligibilities       e  ON s.nct_id = e.nct_id
-        LEFT OUTER JOIN all_id_information  id ON s.nct_id = id.nct_id
-        LEFT OUTER JOIN all_design_outcomes o  ON s.nct_id = o.nct_id
-        LEFT OUTER JOIN designs             d  ON s.nct_id = d.nct_id
-        ;
-        $_$;
-
-
 SET default_tablespace = '';
 
 SET default_table_access_method = heap;



--
-- Name: baseline_counts id; Type: DEFAULT; Schema: ctgov_beta; Owner: -
--

ALTER TABLE ONLY ctgov_beta.baseline_counts ALTER COLUMN id SET DEFAULT nextval('ctgov_beta.baseline_counts_id_seq'::regclass);


--
-- Name: baseline_measurements id; Type: DEFAULT; Schema: ctgov_beta; Owner: -
--

ALTER TABLE ONLY ctgov_beta.baseline_measurements ALTER COLUMN id SET DEFAULT nextval('ctgov_beta.baseline_measurements_id_seq'::regclass);


--
-- Name: brief_summaries id; Type: DEFAULT; Schema: ctgov_beta; Owner: -
--

ALTER TABLE ONLY ctgov_beta.brief_summaries ALTER COLUMN id SET DEFAULT nextval('ctgov_beta.brief_summaries_id_seq'::regclass);


--
-- Name: browse_conditions id; Type: DEFAULT; Schema: ctgov_beta; Owner: -
--

ALTER TABLE ONLY ctgov_beta.browse_conditions ALTER COLUMN id SET DEFAULT nextval('ctgov_beta.browse_conditions_id_seq'::regclass);


--
-- Name: browse_interventions id; Type: DEFAULT; Schema: ctgov_beta; Owner: -
--

ALTER TABLE ONLY ctgov_beta.browse_interventions ALTER COLUMN id SET DEFAULT nextval('ctgov_beta.browse_interventions_id_seq'::regclass);


--
-- Name: calculated_values id; Type: DEFAULT; Schema: ctgov_beta; Owner: -
--

ALTER TABLE ONLY ctgov_beta.calculated_values ALTER COLUMN id SET DEFAULT nextval('ctgov_beta.calculated_values_id_seq'::regclass);


--
-- Name: central_contacts id; Type: DEFAULT; Schema: ctgov_beta; Owner: -
--

ALTER TABLE ONLY ctgov_beta.central_contacts ALTER COLUMN id SET DEFAULT nextval('ctgov_beta.central_contacts_id_seq'::regclass);


--
-- Name: conditions id; Type: DEFAULT; Schema: ctgov_beta; Owner: -
--

ALTER TABLE ONLY ctgov_beta.conditions ALTER COLUMN id SET DEFAULT nextval('ctgov_beta.conditions_id_seq'::regclass);


--
-- Name: countries id; Type: DEFAULT; Schema: ctgov_beta; Owner: -
--

ALTER TABLE ONLY ctgov_beta.countries ALTER COLUMN id SET DEFAULT nextval('ctgov_beta.countries_id_seq'::regclass);


--
-- Name: design_group_interventions id; Type: DEFAULT; Schema: ctgov_beta; Owner: -
--

ALTER TABLE ONLY ctgov_beta.design_group_interventions ALTER COLUMN id SET DEFAULT nextval('ctgov_beta.design_group_interventions_id_seq'::regclass);


--
-- Name: design_groups id; Type: DEFAULT; Schema: ctgov_beta; Owner: -
--

ALTER TABLE ONLY ctgov_beta.design_groups ALTER COLUMN id SET DEFAULT nextval('ctgov_beta.design_groups_id_seq'::regclass);


--
-- Name: design_outcomes id; Type: DEFAULT; Schema: ctgov_beta; Owner: -
--

ALTER TABLE ONLY ctgov_beta.design_outcomes ALTER COLUMN id SET DEFAULT nextval('ctgov_beta.design_outcomes_id_seq'::regclass);


--
-- Name: designs id; Type: DEFAULT; Schema: ctgov_beta; Owner: -
--

ALTER TABLE ONLY ctgov_beta.designs ALTER COLUMN id SET DEFAULT nextval('ctgov_beta.designs_id_seq'::regclass);


--
-- Name: detailed_descriptions id; Type: DEFAULT; Schema: ctgov_beta; Owner: -
--

ALTER TABLE ONLY ctgov_beta.detailed_descriptions ALTER COLUMN id SET DEFAULT nextval('ctgov_beta.detailed_descriptions_id_seq'::regclass);


--
-- Name: documents id; Type: DEFAULT; Schema: ctgov_beta; Owner: -
--

ALTER TABLE ONLY ctgov_beta.documents ALTER COLUMN id SET DEFAULT nextval('ctgov_beta.documents_id_seq'::regclass);


--
-- Name: drop_withdrawals id; Type: DEFAULT; Schema: ctgov_beta; Owner: -
--

ALTER TABLE ONLY ctgov_beta.drop_withdrawals ALTER COLUMN id SET DEFAULT nextval('ctgov_beta.drop_withdrawals_id_seq'::regclass);


--
-- Name: eligibilities id; Type: DEFAULT; Schema: ctgov_beta; Owner: -
--

ALTER TABLE ONLY ctgov_beta.eligibilities ALTER COLUMN id SET DEFAULT nextval('ctgov_beta.eligibilities_id_seq'::regclass);


--
-- Name: facilities id; Type: DEFAULT; Schema: ctgov_beta; Owner: -
--

ALTER TABLE ONLY ctgov_beta.facilities ALTER COLUMN id SET DEFAULT nextval('ctgov_beta.facilities_id_seq'::regclass);


--
-- Name: facility_contacts id; Type: DEFAULT; Schema: ctgov_beta; Owner: -
--

ALTER TABLE ONLY ctgov_beta.facility_contacts ALTER COLUMN id SET DEFAULT nextval('ctgov_beta.facility_contacts_id_seq'::regclass);


--
-- Name: facility_investigators id; Type: DEFAULT; Schema: ctgov_beta; Owner: -
--

ALTER TABLE ONLY ctgov_beta.facility_investigators ALTER COLUMN id SET DEFAULT nextval('ctgov_beta.facility_investigators_id_seq'::regclass);


--
-- Name: id_information id; Type: DEFAULT; Schema: ctgov_beta; Owner: -
--

ALTER TABLE ONLY ctgov_beta.id_information ALTER COLUMN id SET DEFAULT nextval('ctgov_beta.id_information_id_seq'::regclass);


--
-- Name: intervention_other_names id; Type: DEFAULT; Schema: ctgov_beta; Owner: -
--

ALTER TABLE ONLY ctgov_beta.intervention_other_names ALTER COLUMN id SET DEFAULT nextval('ctgov_beta.intervention_other_names_id_seq'::regclass);


--
-- Name: interventions id; Type: DEFAULT; Schema: ctgov_beta; Owner: -
--

ALTER TABLE ONLY ctgov_beta.interventions ALTER COLUMN id SET DEFAULT nextval('ctgov_beta.interventions_id_seq'::regclass);


--
-- Name: ipd_information_types id; Type: DEFAULT; Schema: ctgov_beta; Owner: -
--

ALTER TABLE ONLY ctgov_beta.ipd_information_types ALTER COLUMN id SET DEFAULT nextval('ctgov_beta.ipd_information_types_id_seq'::regclass);


--
-- Name: keywords id; Type: DEFAULT; Schema: ctgov_beta; Owner: -
--

ALTER TABLE ONLY ctgov_beta.keywords ALTER COLUMN id SET DEFAULT nextval('ctgov_beta.keywords_id_seq'::regclass);


--
-- Name: links id; Type: DEFAULT; Schema: ctgov_beta; Owner: -
--

ALTER TABLE ONLY ctgov_beta.links ALTER COLUMN id SET DEFAULT nextval('ctgov_beta.links_id_seq'::regclass);


--
-- Name: mesh_headings id; Type: DEFAULT; Schema: ctgov_beta; Owner: -
--

ALTER TABLE ONLY ctgov_beta.mesh_headings ALTER COLUMN id SET DEFAULT nextval('ctgov_beta.mesh_headings_id_seq'::regclass);


--
-- Name: mesh_terms id; Type: DEFAULT; Schema: ctgov_beta; Owner: -
--

ALTER TABLE ONLY ctgov_beta.mesh_terms ALTER COLUMN id SET DEFAULT nextval('ctgov_beta.mesh_terms_id_seq'::regclass);


--
-- Name: milestones id; Type: DEFAULT; Schema: ctgov_beta; Owner: -
--

ALTER TABLE ONLY ctgov_beta.milestones ALTER COLUMN id SET DEFAULT nextval('ctgov_beta.milestones_id_seq'::regclass);


--
-- Name: outcome_analyses id; Type: DEFAULT; Schema: ctgov_beta; Owner: -
--

ALTER TABLE ONLY ctgov_beta.outcome_analyses ALTER COLUMN id SET DEFAULT nextval('ctgov_beta.outcome_analyses_id_seq'::regclass);


--
-- Name: outcome_analysis_groups id; Type: DEFAULT; Schema: ctgov_beta; Owner: -
--

ALTER TABLE ONLY ctgov_beta.outcome_analysis_groups ALTER COLUMN id SET DEFAULT nextval('ctgov_beta.outcome_analysis_groups_id_seq'::regclass);


--
-- Name: outcome_counts id; Type: DEFAULT; Schema: ctgov_beta; Owner: -
--

ALTER TABLE ONLY ctgov_beta.outcome_counts ALTER COLUMN id SET DEFAULT nextval('ctgov_beta.outcome_counts_id_seq'::regclass);


--
-- Name: outcome_measurements id; Type: DEFAULT; Schema: ctgov_beta; Owner: -
--

ALTER TABLE ONLY ctgov_beta.outcome_measurements ALTER COLUMN id SET DEFAULT nextval('ctgov_beta.outcome_measurements_id_seq'::regclass);


--
-- Name: outcomes id; Type: DEFAULT; Schema: ctgov_beta; Owner: -
--

ALTER TABLE ONLY ctgov_beta.outcomes ALTER COLUMN id SET DEFAULT nextval('ctgov_beta.outcomes_id_seq'::regclass);


--
-- Name: overall_officials id; Type: DEFAULT; Schema: ctgov_beta; Owner: -
--

ALTER TABLE ONLY ctgov_beta.overall_officials ALTER COLUMN id SET DEFAULT nextval('ctgov_beta.overall_officials_id_seq'::regclass);


--
-- Name: participant_flows id; Type: DEFAULT; Schema: ctgov_beta; Owner: -
--

ALTER TABLE ONLY ctgov_beta.participant_flows ALTER COLUMN id SET DEFAULT nextval('ctgov_beta.participant_flows_id_seq'::regclass);


--
-- Name: pending_results id; Type: DEFAULT; Schema: ctgov_beta; Owner: -
--

ALTER TABLE ONLY ctgov_beta.pending_results ALTER COLUMN id SET DEFAULT nextval('ctgov_beta.pending_results_id_seq'::regclass);


--
-- Name: provided_documents id; Type: DEFAULT; Schema: ctgov_beta; Owner: -
--

ALTER TABLE ONLY ctgov_beta.provided_documents ALTER COLUMN id SET DEFAULT nextval('ctgov_beta.provided_documents_id_seq'::regclass);


--
-- Name: reported_event_totals id; Type: DEFAULT; Schema: ctgov_beta; Owner: -
--

ALTER TABLE ONLY ctgov_beta.reported_event_totals ALTER COLUMN id SET DEFAULT nextval('ctgov_beta.reported_event_totals_id_seq'::regclass);


--
-- Name: reported_events id; Type: DEFAULT; Schema: ctgov_beta; Owner: -
--

ALTER TABLE ONLY ctgov_beta.reported_events ALTER COLUMN id SET DEFAULT nextval('ctgov_beta.reported_events_id_seq'::regclass);


--
-- Name: responsible_parties id; Type: DEFAULT; Schema: ctgov_beta; Owner: -
--

ALTER TABLE ONLY ctgov_beta.responsible_parties ALTER COLUMN id SET DEFAULT nextval('ctgov_beta.responsible_parties_id_seq'::regclass);


--
-- Name: result_agreements id; Type: DEFAULT; Schema: ctgov_beta; Owner: -
--

ALTER TABLE ONLY ctgov_beta.result_agreements ALTER COLUMN id SET DEFAULT nextval('ctgov_beta.result_agreements_id_seq'::regclass);


--
-- Name: result_contacts id; Type: DEFAULT; Schema: ctgov_beta; Owner: -
--

ALTER TABLE ONLY ctgov_beta.result_contacts ALTER COLUMN id SET DEFAULT nextval('ctgov_beta.result_contacts_id_seq'::regclass);


--
-- Name: result_groups id; Type: DEFAULT; Schema: ctgov_beta; Owner: -
--

ALTER TABLE ONLY ctgov_beta.result_groups ALTER COLUMN id SET DEFAULT nextval('ctgov_beta.result_groups_id_seq'::regclass);


--
-- Name: search_results id; Type: DEFAULT; Schema: ctgov_beta; Owner: -
--

ALTER TABLE ONLY ctgov_beta.search_results ALTER COLUMN id SET DEFAULT nextval('ctgov_beta.search_results_id_seq'::regclass);


--
-- Name: sponsors id; Type: DEFAULT; Schema: ctgov_beta; Owner: -
--

ALTER TABLE ONLY ctgov_beta.sponsors ALTER COLUMN id SET DEFAULT nextval('ctgov_beta.sponsors_id_seq'::regclass);


--
-- Name: study_references id; Type: DEFAULT; Schema: ctgov_beta; Owner: -
--

ALTER TABLE ONLY ctgov_beta.study_references ALTER COLUMN id SET DEFAULT nextval('ctgov_beta.study_references_id_seq'::regclass);


--
-- Name: study_searches id; Type: DEFAULT; Schema: ctgov_beta; Owner: -
--

ALTER TABLE ONLY ctgov_beta.study_searches ALTER COLUMN id SET DEFAULT nextval('ctgov_beta.study_searches_id_seq'::regclass);


--
-- Name: load_events id; Type: DEFAULT; Schema: support; Owner: -
--


--

CREATE TRIGGER category_insert_trigger INSTEAD OF INSERT ON ctgov.categories FOR EACH ROW EXECUTE FUNCTION ctgov.category_insert_function();


--
