-
Notifications
You must be signed in to change notification settings - Fork 185
Add option to cursor comparison to ignore the order of the columns #779
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @oklimberg the example is a little misleading but order clause there is not required. procedure unordered_tst is
l_actual sys_refcursor;
l_expected sys_refcursor;
begin
open l_expected for select username, user_id from all_users
union all
select 'TEST' username, -600 user_id from dual;
open l_actual for select username, user_id from all_users
union all
select 'TEST' username, -610 user_id from dual;
ut.expect( l_actual ).to_equal( l_expected ).unordered;
end; Above test will result in two differences of one row extra and one row missing. Diff:
Rows: [ 2 differences ]
Missing: <ROW><USERNAME>TEST</USERNAME><USER_ID>-600</USER_ID></ROW>
Extra: <ROW><USERNAME>TEST</USERNAME><USER_ID>-610</USER_ID></ROW> Is that what you looking for ? |
Hi @lwasylow i already checked out the currently available options, but they do not provide the functionality I proposed. I would like to have an extended_option, e.g.
Using only
|
Currently, utPLSQL performs compound data comparison (cursor/object/nested table) by column/attribute position and name. The ask is to have Sounds like a feature to be implemented as additional option to compound data comparison. |
Is there any reason why we should not make that behavior default for comparing with options:
I think the column position is only relevant in standard matcher where the data has to be ordered (due to implementation) |
Hmmm... |
Is there a specific requirement to check columns ordering ? I would say for any check unordered the columns should be unordered too. |
The place where order matters is when you have a PLSQL function that returns a refcursor. If you want to fetch it, you need a record type that matches the cursor result columns by position and by data-type. When you fetch into record, order of columns is essential. Similar scenario is when you do union/minus/intersect in SQL or when you do I do agree that |
If there’s no performance difference then suggest the default to be unordered (ie match by name. ) with capability of forcing specific order match. |
I think also default should be unordered and if there is a specific scenario pass new option .ordered_columns |
Its been agreed that to not break existing functionality and to mirror logic of SQL statement where order of columns matter (e.g. union all) we will provide an option to explicit force unordered columns via |
It would be nice to have such a feature, so the user could simply make a statemement like
select * from table1
rather than specifying the order of the columns by hand likeselect col1, col2 from table1
.I got a test case, where I check if certain entries have been copied from table1 to table2.
Both tables will certainly get new columns over the time and I woud like to write the test in a way, that I do not have to add the new columns there as well.
Specifying the order manually would not check new columns, unless the test is also updated.
The text was updated successfully, but these errors were encountered: