diff --git a/bootstrap/018_warehouse_updates.sql b/bootstrap/018_warehouse_updates.sql index ac80b1e8..2b411f98 100644 --- a/bootstrap/018_warehouse_updates.sql +++ b/bootstrap/018_warehouse_updates.sql @@ -110,12 +110,13 @@ BEGIN CALL INTERNAL.SET_CONFIG('WAREHOUSE_EVENTS_MAINTENANCE', CURRENT_TIMESTAMP()::string); END; -CREATE OR REPLACE FUNCTION TOOLS.APPROX_CREDITS_USED(warehouse_name varchar, start_time timestamp, end_time timestamp) +CREATE OR REPLACE FUNCTION TOOLS.APPROX_CREDITS_USED(wh_name varchar, start_time timestamp, end_time timestamp) RETURNS NUMBER AS $$ - TOOLS.WAREHOUSE_CREDITS_PER_MILLI((select warehouse_size from internal.warehouse_size_mapping t where t.warehouse_name = warehouse_name), - coalesce((select warehouse_type from internal.warehouse_size_mapping t where t.warehouse_name = warehouse_name), 'STANDARD'))*timestampdiff(millisecond, start_time, end_time) + TOOLS.WAREHOUSE_CREDITS_PER_MILLI( + (select any_value(warehouse_size) from internal.warehouse_size_mapping t where t.warehouse_name = wh_name), + coalesce((select any_value(warehouse_type) from internal.warehouse_size_mapping t where t.warehouse_name = wh_name), 'STANDARD'))*timestampdiff(millisecond, start_time, end_time) $$; CREATE OR REPLACE FUNCTION TOOLS.APPROX_CREDITS_USED(warehouse_name varchar, start_time timestamp) diff --git a/bootstrap/090_post_setup.sql b/bootstrap/090_post_setup.sql index 267510a5..bd02c70b 100644 --- a/bootstrap/090_post_setup.sql +++ b/bootstrap/090_post_setup.sql @@ -179,7 +179,7 @@ Query Text: {bt}{bt}{bt}{query_text}{bt}{bt}{bt} EXCEPTION WHEN OTHER THEN SYSTEM$LOG_ERROR(OBJECT_CONSTRUCT('error', 'Unhandled exception occurred during probe monitoring.', 'SQLCODE', :sqlcode, 'SQLERRM', :sqlerrm, 'SQLSTATE', :sqlstate)); - insert into internal.probe_actions select CURRENT_TIMESTAMP(), '', '', null::VARIANT, 'Caught unhandled exception'; + insert into internal.probe_actions select CURRENT_TIMESTAMP(), '', '', null::VARIANT, 'Caught unhandled exception: ' || :sqlerrm; RAISE; END;