Skip to content

invalid identifier error thrown when using "join_by" #770

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

Closed
PhilippSalvisberg opened this issue Oct 27, 2018 · 7 comments
Closed

invalid identifier error thrown when using "join_by" #770

PhilippSalvisberg opened this issue Oct 27, 2018 · 7 comments
Assignees
Labels
Milestone

Comments

@PhilippSalvisberg
Copy link
Member

Here's an example:

CREATE OR REPLACE PACKAGE test_join_by IS

   --%suite

   --%test
   PROCEDURE p;
      
END test_join_by;
/

CREATE OR REPLACE PACKAGE BODY test_join_by IS

   PROCEDURE p IS
      l_actual   sys_refcursor;
      l_expected sys_refcursor;
   BEGIN
      OPEN l_actual FOR 
         SELECT 1       AS PK, 
                'hello' AS text
           FROM DUAL;

      OPEN l_expected FOR 
         SELECT 1       AS PK, 
                'hello' AS text
           FROM DUAL;

      ut.expect(l_actual).to_equal(l_expected)
         .join_by('PK');
   END p;

END test_join_by;
/

SET SERVEROUTPUT ON SIZE UNLIMITED
EXECUTE ut.run('TEST_JOIN_BY');

When running as user SCOTT I get the following output:


Package TEST_JOIN_BY compiled


Package Body TEST_JOIN_BY compiled

test_join_by
  p [.063 sec] (FAILED - 1)
 
Failures:
 
  1) p
      ORA-00904: "UT3_LATEST_RELEASE"."UT_COMPOUND_DATA_HELPER"."GET_HASH": invalid identifier
      ORA-06512: at "UT3_LATEST_RELEASE.UT_COMPOUND_DATA_VALUE", line 235
      ORA-06512: at "UT3_LATEST_RELEASE.UT_DATA_VALUE_REFCURSOR", line 251
      ORA-06512: at "UT3_LATEST_RELEASE.UT_EQUAL", line 236
      ORA-06512: at "UT3_LATEST_RELEASE.UT_EXPECTATION", line 24
      ORA-06512: at "UT3_LATEST_RELEASE.UT_EXPECTATION_COMPOUND", line 189
      ORA-06512: at "SCOTT.TEST_JOIN_BY", line 17
      ORA-06512: at "UT3_LATEST_RELEASE.UT_COMPOUND_DATA_VALUE", line 235
      ORA-06512: at "UT3_LATEST_RELEASE.UT_DATA_VALUE_REFCURSOR", line 251
      ORA-06512: at "UT3_LATEST_RELEASE.UT_EQUAL", line 236
      ORA-06512: at "UT3_LATEST_RELEASE.UT_EXPECTATION", line 24
      ORA-06512: at "UT3_LATEST_RELEASE.UT_EXPECTATION_COMPOUND", line 189
      ORA-06512: at "SCOTT.TEST_JOIN_BY", line 17
      ORA-06512: at line 6
Finished in .065898 seconds
1 tests, 0 failed, 1 errored, 0 disabled, 0 warning(s)
 


PL/SQL procedure successfully completed.

Works when running as ut3, ut3_latest_release or ut3_tester.

I guess some grants are missing.

@jgebal
Copy link
Member

jgebal commented Oct 27, 2018

Is it the same on develop version?

@PhilippSalvisberg
Copy link
Member Author

not tested.

@PhilippSalvisberg
Copy link
Member Author

Quick fix GRANT EXECUTE ON "UT3_LATEST_RELEASE"."UT_COMPOUND_DATA_HELPER" TO PUBLIC;

@jgebal
Copy link
Member

jgebal commented Oct 27, 2018

It will be same.
@lwasylow, I think the merge statement should be moved from ut_compund_data_value into a helper package that runs as authid definer. The same with the insert statement below it.
That way we don't need to worry about exposing (granting) internal elements of framework to public/users.

@jgebal
Copy link
Member

jgebal commented Oct 27, 2018

Quick fix was my initial thought too. It's not a clean solution though.

@lwasylow lwasylow self-assigned this Oct 27, 2018
@lwasylow
Copy link
Member

Will look onto that

lwasylow added a commit that referenced this issue Oct 27, 2018
…ich can result in error due to missing privs to internal function
lwasylow added a commit that referenced this issue Nov 1, 2018
…ich can result in error due to missing privs to internal function
@lwasylow lwasylow added the bug label Nov 2, 2018
@lwasylow lwasylow added this to the v3.1.3 milestone Nov 2, 2018
@jgebal
Copy link
Member

jgebal commented Nov 17, 2018

Closing as it's fixed by #773

@jgebal jgebal closed this as completed Nov 17, 2018
@jgebal jgebal reopened this Nov 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants