Skip to content

Commit aa754f7

Browse files
yahondaclaude
andcommitted
Use standalone function with %ROWTYPE parameter for TIMESTAMP LTZ test
The previous test used a pipelined function inside a package, which has a different metadata path that does not populate field definitions for TABLE OF %ROWTYPE elements. Use a standalone function with a %ROWTYPE parameter instead, which directly exercises the get_field_definitions code path where the remap is applied. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 5415081 commit aa754f7

1 file changed

Lines changed: 10 additions & 16 deletions

File tree

spec/plsql/procedure_spec.rb

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2386,37 +2386,31 @@ def new_candidate(status)
23862386
end
23872387
end
23882388

2389-
describe "Function with table type containing TIMESTAMP WITH LOCAL TIME ZONE" do
2389+
describe "Function with TIMESTAMP WITH LOCAL TIME ZONE column in %ROWTYPE" do
23902390
before(:all) do
23912391
plsql.connect! CONNECTION_PARAMS
2392-
plsql.execute "DROP PACKAGE test_timestamp_ltz_pkg" rescue nil
2392+
plsql.execute "DROP FUNCTION test_timestamp_ltz_fn" rescue nil
23932393
plsql.execute "DROP TABLE test_timestamp_ltz" rescue nil
23942394
plsql.execute "CREATE TABLE test_timestamp_ltz (id NUMBER, ts TIMESTAMP WITH LOCAL TIME ZONE)"
23952395
plsql.execute <<-SQL
2396-
CREATE OR REPLACE PACKAGE test_timestamp_ltz_pkg IS
2397-
TYPE t_tab IS TABLE OF test_timestamp_ltz%ROWTYPE;
2398-
FUNCTION test_fn RETURN t_tab PIPELINED;
2399-
END;
2400-
SQL
2401-
plsql.execute <<-SQL
2402-
CREATE OR REPLACE PACKAGE BODY test_timestamp_ltz_pkg IS
2403-
FUNCTION test_fn RETURN t_tab PIPELINED IS
2404-
BEGIN
2405-
NULL;
2406-
END;
2396+
CREATE OR REPLACE FUNCTION test_timestamp_ltz_fn(p_rec test_timestamp_ltz%ROWTYPE)
2397+
RETURN NUMBER
2398+
IS
2399+
BEGIN
2400+
RETURN p_rec.id;
24072401
END;
24082402
SQL
24092403
end
24102404

24112405
after(:all) do
2412-
plsql.execute "DROP PACKAGE test_timestamp_ltz_pkg" rescue nil
2406+
plsql.execute "DROP FUNCTION test_timestamp_ltz_fn" rescue nil
24132407
plsql.execute "DROP TABLE test_timestamp_ltz" rescue nil
24142408
plsql.logoff
24152409
end
24162410

24172411
it "should remap TIMESTAMP(n) WITH LOCAL TIME ZONE to TIMESTAMP WITH LOCAL TIME ZONE" do
2418-
return_metadata = PLSQL::Procedure.find(plsql, :test_fn, "TEST_TIMESTAMP_LTZ_PKG")
2419-
fields = return_metadata.return[0][:element][:fields]
2412+
procedure = PLSQL::Procedure.find(plsql, :test_timestamp_ltz_fn)
2413+
fields = procedure.arguments[0][:p_rec][:fields]
24202414
expect(fields[:ts][:data_type]).to eq("TIMESTAMP WITH LOCAL TIME ZONE")
24212415
end
24222416
end

0 commit comments

Comments
 (0)