Skip to content

Commit ea28e73

Browse files
yahondajoschugclaude
committed
WIP: Test hidden columns with ALL_TAB_COLS to verify test fails
Temporarily revert to ALL_TAB_COLS (without hidden column filter) to confirm the new test detects hidden columns. If the test fails, the fix (switching to ALL_TAB_COLUMNS) is validated. Based on #208 Co-Authored-By: Jochen Schug <4573581+joschug@users.noreply.github.com> Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 39cf870 commit ea28e73

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

spec/plsql/procedure_spec.rb

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2385,3 +2385,42 @@ def new_candidate(status)
23852385
expect { plsql.test_func(p_STRING: "xxx") }.not_to raise_error
23862386
end
23872387
end
2388+
2389+
describe "Procedure with %ROWTYPE parameter on table that has hidden columns" do
2390+
before(:all) do
2391+
plsql.connect! CONNECTION_PARAMS
2392+
plsql.execute "CREATE TABLE test_hidden_cols (col1 VARCHAR2(50), col2 VARCHAR2(50))"
2393+
# Functional index creates a hidden column in ALL_TAB_COLS
2394+
plsql.execute "CREATE INDEX test_hidden_cols_idx ON test_hidden_cols (UPPER(col1))"
2395+
plsql.execute <<-SQL
2396+
CREATE OR REPLACE PACKAGE test_hidden_cols_pkg IS
2397+
PROCEDURE test_proc(p_rec IN test_hidden_cols%ROWTYPE);
2398+
END;
2399+
SQL
2400+
plsql.execute <<-SQL
2401+
CREATE OR REPLACE PACKAGE BODY test_hidden_cols_pkg IS
2402+
PROCEDURE test_proc(p_rec IN test_hidden_cols%ROWTYPE) IS
2403+
BEGIN
2404+
NULL;
2405+
END;
2406+
END;
2407+
SQL
2408+
end
2409+
2410+
after(:all) do
2411+
plsql.execute "DROP PACKAGE test_hidden_cols_pkg" rescue nil
2412+
plsql.execute "DROP TABLE test_hidden_cols" rescue nil
2413+
plsql.logoff
2414+
end
2415+
2416+
it "should not include hidden columns in %ROWTYPE fields" do
2417+
proc = PLSQL::Procedure.find(plsql, :test_proc, "TEST_HIDDEN_COLS_PKG")
2418+
fields = proc.arguments[0][:p_rec][:fields]
2419+
field_names = fields.keys
2420+
expect(field_names).to include(:col1)
2421+
expect(field_names).to include(:col2)
2422+
# Use string comparison instead of symbol literal (e.g., :sys_nc00003$)
2423+
# because $ in symbol literals is a syntax error in the Ruby 2.4 parser
2424+
expect(field_names.none? { |name| name.to_s.start_with?("sys_nc") }).to be true
2425+
end
2426+
end

0 commit comments

Comments
 (0)