create view rich700_lookup_vers_at_date ( context_id, version, valid_since, valid_until ) as select context_id, vers_id, valid_since, valid_until from rich700_trb3lookup where hades_oper.run_query_2.get_date between valid_since and valid_until and hades_oper.run_query_2.get_history_date between date_create and invalid_since; COMMENT ON TABLE rich700_lookup_vers_at_date IS 'Version of TRB3 unpacker lookup table for the RICH700 detector (used in HYDRA2)'; COMMENT ON COLUMN rich700_lookup_vers_at_date.context_id IS 'Identifier for the parameter context'; COMMENT ON COLUMN rich700_lookup_vers_at_date.version IS 'Version of the parameters'; COMMENT ON COLUMN rich700_lookup_vers_at_date.valid_since IS 'Date (Run start), when this version gets valid'; COMMENT ON COLUMN rich700_lookup_vers_at_date.valid_until IS 'Last date (Run stop), when this version is still valid';