@@ -449,29 +449,29 @@ SELECT id, msg FROM autonomous_test WHERE id = 53;
449449-- Test 19: Function returning DATE (pass-by-value)
450450-- Tests date type handling
451451--
452- CREATE OR REPLACE FUNCTION test_function_date(p_days_offset INT) RETURN DATE AS
452+ CREATE OR REPLACE FUNCTION test_function_date(p_base_date DATE, p_days_offset INT) RETURN DATE AS
453453DECLARE
454454 PRAGMA AUTONOMOUS_TRANSACTION;
455455 v_result DATE;
456456BEGIN
457- v_result := CURRENT_DATE + p_days_offset;
457+ v_result := p_base_date + p_days_offset;
458458 INSERT INTO autonomous_test VALUES (54, 'date: ' || v_result::TEXT, 'committed');
459459 RETURN v_result;
460460END;
461461/
462462COMMIT;
463463WARNING: there is no transaction in progress
464- -- Returns date 7 days from now
465- SELECT test_function_date(7) AS date_result;
464+ -- Returns date 7 days from base date (using fixed date for deterministic test)
465+ SELECT test_function_date('2025-01-01'::DATE, 7) AS date_result;
466466 date_result
467467-------------
468- 2025-12 -08
468+ 2025-01 -08
469469(1 row)
470470
471471SELECT id, msg FROM autonomous_test WHERE id = 54;
472472 id | msg
473473----+------------------
474- 54 | date: 2025-12 -08
474+ 54 | date: 2025-01 -08
475475(1 row)
476476
477477--
@@ -534,6 +534,6 @@ DROP FUNCTION test_function_text(TEXT);
534534DROP FUNCTION inner_function(INT);
535535DROP FUNCTION outer_function(INT);
536536DROP FUNCTION test_function_numeric(NUMERIC);
537- DROP FUNCTION test_function_date(INT);
537+ DROP FUNCTION test_function_date(DATE, INT);
538538DROP FUNCTION test_function_boolean(INT);
539539DROP TABLE autonomous_test;
0 commit comments