Skip to content
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

System function RDB$ROLE_IN_USE cannot take long role names [CORE5593] #5859

Closed
firebird-issue-importer opened this issue Aug 7, 2017 · 7 comments

Comments

@firebird-issue-importer
Copy link

@firebird-issue-importer firebird-issue-importer commented Aug 7, 2017

Submitted by: @helebor

Function RDB$ROLE_IN_USE takes a varchar(32), which is meant to be a role name. Varchar(32) won't be long enough to take
a longer role name.

Commits: 61b4bf0

====== Test Details ======

We also have to check cases when role contains NON-ASCII characters but currently this is impossible.
Exception like:

  Statement failed, SQLSTATE = 22001
  arithmetic exception, numeric overflow, or string truncation
  \-string right truncation
  \-expected length 63, actual 79

===
- is raised when non-ascii role contains only ~40 *characters* and connection charset = UTF8.
Sent letter to Alex, 23.06.2018 09:21, waiting for reply.

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Aug 8, 2017

Modified by: @AlexPeshkoff

assignee: Alexander Peshkov [ alexpeshkoff ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Aug 8, 2017

Modified by: @AlexPeshkoff

Version: 4.0 Alpha 1 [ 10731 ]

Version: 4.0 Initial [ 10621 ] =>

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Aug 8, 2017

Commented by: @dyemanov

I don't see this issue in the code. All built-in functions don't have declared parameter types/lengths, they accept whatever is passed. The problem is whether the argument can be converted to the expected datatype. RDB$ROLE_IN_USE expects a string of arbitrary length, I don't see any limit implied there.

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Aug 8, 2017

Commented by: @AlexPeshkoff

When long role name is used RDB$ROLE_IN_USE incorrectly returns false even in a case RDB$ROLE_IN_USE(current_role)

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jun 22, 2018

Commented by: @AlexPeshkoff

There were 2 issues - first, varchar(32) in documentation, which was obviously wrong limit, Dmitry is right, built-in functions accept whatever is passed. But there was one more issue - case sensitivity. I've blindly uppercased role name what is definitely wrong - we may have roles with lower case letters, moreover, we may have SOMEROLE and SomeRole, and that will be 2 different roles.

The small problem with this function is that we can't use double quotes to mark names of case-sensitive roles - we should be able to accept strings returned by CURRENT_ROLE, values in RDB$ROLE_NAME field, and they all do not contain double quotes. Therefore the only working solution is to always enter role name case sensitive.

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jun 22, 2018

Modified by: @AlexPeshkoff

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 4.0 Beta 1 [ 10750 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jun 23, 2018

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Resolved [ 5 ]

QA Status: No test => Done with caveats

Test Details: We also have to check cases when role contains NON-ASCII characters but currently this is impossible.
Exception like:

  Statement failed, SQLSTATE = 22001
  arithmetic exception, numeric overflow, or string truncation
  \-string right truncation
  \-expected length 63, actual 79

===
- is raised when non-ascii role contains only ~40 *characters* and connection charset = UTF8.
Sent letter to Alex, 23.06.2018 09:21, waiting for reply.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants