Derby
  1. Derby
  2. DERBY-1825

Errors 2850A,2850G,28508 are similar - can be combined into a single message.

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: SQL
    • Labels:
      None

      Description

      ERROR 2850A: User 'SAM' does not have execute permission on PROCEDURE 'SYSCS_UTIL'.'SYSCS_EXPORT_TABLE'.

      ERROR 2850G: User 'MAMTA2' does not have grant permission on object 'MAMTA2'.'V21VIEWTEST'.

      ERROR 28508: User 'MAMTA3' does not have select permission on column 'C111' of table 'MAMTA2'.'V21VIEWTEST'.

      1. DERBY-1825-1.diff
        7 kB
        Jørgen Løland
      2. DERBY-1825-1.stat
        0.8 kB
        Jørgen Løland

        Issue Links

          Activity

          Daniel John Debrunner created issue -
          Hide
          Daniel John Debrunner added a comment -

          Combined messages should use the correct SQL state, see DERBY-1828

          Show
          Daniel John Debrunner added a comment - Combined messages should use the correct SQL state, see DERBY-1828
          Daniel John Debrunner made changes -
          Field Original Value New Value
          Link This issue blocks DERBY-1828 [ DERBY-1828 ]
          Jørgen Løland made changes -
          Assignee Jørgen Løland [ jorgenlo ]
          Hide
          Jørgen Løland added a comment -

          I have looked into all the '28'-error messages. I suggest that
          the following similar errors are combined:

          Errors 28506, 2850A and 2850G replaced by:
          <msg>
          <name>28506</name>
          <text>User '

          {0}' does not have {1} permission on {2} '{3}'.'{4}'.</text>
          <arg>authorizationID</arg>
          <arg>permissionName</arg>
          <arg>objectType</arg>
          <arg>schemaName</arg>
          <arg>objectName</arg>
          </msg>

          Errors 28507 and 2850B replaced by:
          <msg>
          <name>28507</name>
          <text>User '{0}

          ' does not have

          {1} permission on {2} '{3}'.'{4}' for grant.</text>
          <arg>authorizationID</arg>
          <arg>permissionType</arg>
          <arg>objectType</arg>
          <arg>schemaName</arg>
          <arg>tableName</arg>
          </msg>

          Errors 2850E, 2850H.C, 2850I.C and 2850J.C replaced by
          <msg>
          <name>2850E</name>
          <text>User '{0}' cannot {1}

          {2}

          '

          {3}

          '. Only the database owner can perform this operation.</text>
          <arg>authorizationID</arg>
          <arg>operationType</arg>
          <arg>objectType</arg>
          <arg>objectName</arg>
          </msg>

          Jørgen Løland

          Show
          Jørgen Løland added a comment - I have looked into all the '28'-error messages. I suggest that the following similar errors are combined: Errors 28506, 2850A and 2850G replaced by: <msg> <name>28506</name> <text>User ' {0}' does not have {1} permission on {2} '{3}'.'{4}'.</text> <arg>authorizationID</arg> <arg>permissionName</arg> <arg>objectType</arg> <arg>schemaName</arg> <arg>objectName</arg> </msg> Errors 28507 and 2850B replaced by: <msg> <name>28507</name> <text>User '{0} ' does not have {1} permission on {2} '{3}'.'{4}' for grant.</text> <arg>authorizationID</arg> <arg>permissionType</arg> <arg>objectType</arg> <arg>schemaName</arg> <arg>tableName</arg> </msg> Errors 2850E, 2850H.C, 2850I.C and 2850J.C replaced by <msg> <name>2850E</name> <text>User '{0}' cannot {1} {2} ' {3} '. Only the database owner can perform this operation.</text> <arg>authorizationID</arg> <arg>operationType</arg> <arg>objectType</arg> <arg>objectName</arg> </msg> Jørgen Løland
          Hide
          Dag H. Wanvik added a comment -

          I had 2850H.C, 2850I.C and 2850J.C as one message originally as part of
          DERBY-2264 (see review comment at http://issues.apache.org/jira/browse/DERBY-2264#action_12480398)
          but split them apart since the operation name has to be localized, e.g. "(re)encrypt"
          would be "(re)kryptere" in Norwegian locale, and should not be embedded of the calling code which calls
          the exception constructor. Would your proposed change address this?

          Show
          Dag H. Wanvik added a comment - I had 2850H.C, 2850I.C and 2850J.C as one message originally as part of DERBY-2264 (see review comment at http://issues.apache.org/jira/browse/DERBY-2264#action_12480398 ) but split them apart since the operation name has to be localized, e.g. "(re)encrypt" would be "(re)kryptere" in Norwegian locale, and should not be embedded of the calling code which calls the exception constructor. Would your proposed change address this?
          Hide
          Jørgen Løland added a comment -

          That's a good point, Dag. The current solution does not solve this. Furthermore, I think it may be a bad idea to merge xxxxx.C error codes with xxxxx codes, hence 2850E will not be merged with H, I and J.

          Show
          Jørgen Løland added a comment - That's a good point, Dag. The current solution does not solve this. Furthermore, I think it may be a bad idea to merge xxxxx.C error codes with xxxxx codes, hence 2850E will not be merged with H, I and J.
          Hide
          Jørgen Løland added a comment -

          I have reexamined the error messages with respect to localization. First of all, 2850E, 2850H.C, 2850I.C and 2850J.C are not merged due to the problem described by Dag.

          28506 and 2850G can be merged into one message

          User '

          {0}

          ' does not have

          {1}

          permission on

          {2}

          '

          {3}

          '.'

          {4}

          '.

          If this is done, however, the former "table" and "object" words will be replaced with "Table/View" since this is what is returned from TableDescriptor#getDescriptorType. Hence, the messages

          ERROR 28506: User 'USER2' does not have insert permission on table 'USER1'.'DERBYDB'.
          ERROR 2850G: User 'USER2' does not have grant permission on object 'USER1'.'TEST'.

          will be replaced with

          ERROR 28506: User 'USER2' does not have insert permission on Table/View 'USER1'.'DERBYDB'.
          ERROR 28506: User 'USER2' does not have grant permission on Table/View 'USER1'.'TEST'.

          Note that the privilege names ("select/insert/grant" etc) are not localized in the current code (TablePrivilegeInfo#checkPrivileges and StatementTablePermission#check). If the word "execute" of ERROR 2850A can be non-localized similarly, 2850A can also be merged with 28506 and 2850G.

          1) Should 28506 and 2850G be merged with the described "Table/View" effect?
          2) Should 2850A also be merged with these, resulting in non-localized "execute"?

          The merging of errors 28507 and 2850B inherits both 1) and 2). Hence, if the answer is yes to both questions, they
          will be merged.

          Show
          Jørgen Løland added a comment - I have reexamined the error messages with respect to localization. First of all, 2850E, 2850H.C, 2850I.C and 2850J.C are not merged due to the problem described by Dag. 28506 and 2850G can be merged into one message User ' {0} ' does not have {1} permission on {2} ' {3} '.' {4} '. If this is done, however, the former "table" and "object" words will be replaced with "Table/View" since this is what is returned from TableDescriptor#getDescriptorType. Hence, the messages ERROR 28506: User 'USER2' does not have insert permission on table 'USER1'.'DERBYDB'. ERROR 2850G: User 'USER2' does not have grant permission on object 'USER1'.'TEST'. will be replaced with ERROR 28506: User 'USER2' does not have insert permission on Table/View 'USER1'.'DERBYDB'. ERROR 28506: User 'USER2' does not have grant permission on Table/View 'USER1'.'TEST'. Note that the privilege names ("select/insert/grant" etc) are not localized in the current code (TablePrivilegeInfo#checkPrivileges and StatementTablePermission#check). If the word "execute" of ERROR 2850A can be non-localized similarly, 2850A can also be merged with 28506 and 2850G. 1) Should 28506 and 2850G be merged with the described "Table/View" effect? 2) Should 2850A also be merged with these, resulting in non-localized "execute"? The merging of errors 28507 and 2850B inherits both 1) and 2). Hence, if the answer is yes to both questions, they will be merged.
          Hide
          Dag H. Wanvik added a comment -

          What is localized as far as SQL keywords is a bit tricky, possibly arbitrary currently.
          I guess if you are intending to quote a keyword, no localization is
          wanted, e.g. in Portuguese variant of 2850F, the SQL keyword "GRANT" is used (note uppercase)
          unlocalized.

          If the message intends to reference a concept, a localized version is probably better, e.g.
          in the text for 28508, the Portuguese words "tabela" and "coluna" are used,
          although these are also SQL reserved keywords...

          Do we have any guidelines for this?

          In the current case, I would think that the permission names would not need to be localized,
          but table/view probably should. I am not sure I like the capitalized "Table/View" in the
          middle of a sentence either..

          Show
          Dag H. Wanvik added a comment - What is localized as far as SQL keywords is a bit tricky, possibly arbitrary currently. I guess if you are intending to quote a keyword, no localization is wanted, e.g. in Portuguese variant of 2850F, the SQL keyword "GRANT" is used (note uppercase) unlocalized. If the message intends to reference a concept, a localized version is probably better, e.g. in the text for 28508, the Portuguese words "tabela" and "coluna" are used, although these are also SQL reserved keywords... Do we have any guidelines for this? In the current case, I would think that the permission names would not need to be localized, but table/view probably should. I am not sure I like the capitalized "Table/View" in the middle of a sentence either..
          Hide
          Jørgen Løland added a comment -

          It seems that the effect of merging error messages is that either the messages get ugly due to the "Table/View" text, or information is lost (if I replace "table" with "object" in message 28506). I think this outweighs the positive effects achieved by removing 2 or 3 error codes. Hence, I stop working on this issue.

          I'm attaching a patch for future reference that does what I previously described. I.e., error codes 28506, 2850A and 2850G are merged into one error message 28506:

          User '

          {0}' does not have {1} permission on {2} '{3}'.'{4}'.

          Further, error codes 28507 and 2850B are merged into one message 28507:

          User '{0}

          ' does not have

          {1}

          permission on

          {2}

          '

          {3}

          '.'

          {4}

          ' for grant.

          The patch is not intended for inclusion, and has therefore not been tested.

          Show
          Jørgen Løland added a comment - It seems that the effect of merging error messages is that either the messages get ugly due to the "Table/View" text, or information is lost (if I replace "table" with "object" in message 28506). I think this outweighs the positive effects achieved by removing 2 or 3 error codes. Hence, I stop working on this issue. I'm attaching a patch for future reference that does what I previously described. I.e., error codes 28506, 2850A and 2850G are merged into one error message 28506: User ' {0}' does not have {1} permission on {2} '{3}'.'{4}'. Further, error codes 28507 and 2850B are merged into one message 28507: User '{0} ' does not have {1} permission on {2} ' {3} '.' {4} ' for grant. The patch is not intended for inclusion, and has therefore not been tested.
          Jørgen Løland made changes -
          Attachment DERBY-1825-1.diff [ 12355812 ]
          Attachment DERBY-1825-1.stat [ 12355813 ]
          Jørgen Løland made changes -
          Resolution Won't Fix [ 2 ]
          Status Open [ 1 ] Resolved [ 5 ]
          Hide
          Jørgen Løland added a comment -

          Is it ok to close this issue? There have been no comments since i marked it as Won't Fix on April 19

          Show
          Jørgen Løland added a comment - Is it ok to close this issue? There have been no comments since i marked it as Won't Fix on April 19
          Hide
          Jørgen Løland added a comment -

          I heard no objections against closing the issue, but feel free to reopen it...

          Show
          Jørgen Løland added a comment - I heard no objections against closing the issue, but feel free to reopen it...
          Jørgen Løland made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Knut Anders Hatlen made changes -
          Link This issue is duplicated by DERBY-2127 [ DERBY-2127 ]
          Gavin made changes -
          Workflow jira [ 12383191 ] Default workflow, editable Closed status [ 12797902 ]

            People

            • Assignee:
              Jørgen Løland
              Reporter:
              Daniel John Debrunner
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development