postgresql7.1 select e.config_id, d.default_config_id, case when e.config_id = d.default_config_id then 1 else 0 end as default_config_p, case when d.configurable_p = 't' then 1 else 0 end as configurable_p from portal_datasources d, portal_elements e where e.datasource_id = d.datasource_id and e.element_id = :element_id select portal_element_config__new(:config_id, null);