Skip to content

Added sp_helplogins - stored proc that provides information about logins and users associated with those logins. #3733

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

Open
wants to merge 56 commits into
base: BABEL_5_X_DEV
Choose a base branch
from

Conversation

ayushdsh
Copy link

@ayushdsh ayushdsh commented May 1, 2025

Description

sp_helplogins [ [ @LoginNamePattern = ] N'LoginNamePattern' ] [ ; ] @LoginNamePattern is sys.sysname, with a default of NULL . If specified, @loginnamepattern must exist.

It returns two result sets -
First view - information about all logins present on the server. Second view - information about each login and its mapping with a user in a database or its membership with a database-role

Task - BABEL-5742

Note

Since sp_helplogins returns two result sets and one of them has a uniquely generated SID, tests for now have been disabled.

Issues Resolved

[List any issues this PR will resolve]

Test Scenarios Covered

  • Use case based -

    • Logged-in user is a member of sysadmin role (superuser)
    • Logged-in user is a member of securityadmin role
    • Logged-in user is a member of securityadmin role and also a member of db_securityadmin or db_accessadmin
    • Logged-in user is not a member of securityadmin role
    • Login does not have any users
  • Boundary conditions -

    • Parameter passed is an invalid login
  • Arbitrary inputs -

    • Parameter passed is an invalid login
  • Negative test cases -

    • Parameter passed is empty
    • Parameter passed contains padded spaces L-R
  • Minor version upgrade tests -

    • NA
  • Major version upgrade tests -

    • NA
  • Performance tests -

    • NA
  • Tooling impact -

    • NA
  • Client tests -

    • NA

Check List

  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is under the terms of the Apache 2.0 and PostgreSQL licenses, and grant any person obtaining a copy of the contribution permission to relicense all or a portion of my contribution to the PostgreSQL License solely to contribute all or a portion of my contribution to the PostgreSQL open source project.

For more information on following Developer Certificate of Origin and signing off your commits, please check here.

ayushdsh added 2 commits May 1, 2025 20:22
…information about logins (both SQL and Windows) and users associated with those logins.

sp_helplogins [ [ @LoginNamePattern = ] N'LoginNamePattern' ] [ ; ]
@LoginNamePattern is sys.sysname, with a default of NULL . If specified, @loginnamepattern must exist.

It returns two result sets -
First view - information about all logins present on the server. Second view - information about each login and its mapping with a user in a database or its membership with a database-role

Task - BABEL-5742
@ayushdsh ayushdsh self-assigned this May 1, 2025
@ayushdsh ayushdsh marked this pull request as ready for review May 1, 2025 20:38
@coveralls
Copy link
Collaborator

coveralls commented May 1, 2025

Pull Request Test Coverage Report for Build 15522399581

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 75.454%

Totals Coverage Status
Change from base Build 15464616681: 0.0%
Covered Lines: 48782
Relevant Lines: 64651

💛 - Coveralls

@ayushdsh ayushdsh closed this May 6, 2025
@ayushdsh ayushdsh reopened this May 6, 2025
@ayushdsh ayushdsh closed this May 6, 2025
@ayushdsh ayushdsh reopened this May 6, 2025
@ayushdsh ayushdsh closed this May 6, 2025
@ayushdsh ayushdsh reopened this May 6, 2025
@ayushdsh ayushdsh closed this May 7, 2025
@ayushdsh ayushdsh reopened this May 7, 2025
ayushdsh added 10 commits May 23, 2025 12:34
…information about logins (both SQL and Windows) and users associated with those logins.

sp_helplogins [ [ @LoginNamePattern = ] N'LoginNamePattern' ] [ ; ]
@LoginNamePattern is sys.sysname, with a default of NULL . If specified, @loginnamepattern must exist.

It returns two result sets -
First view - information about all logins present on the server.
Second view - information about each login and its mapping with a user in a database or its membership with a database-role

Task - BABEL-5742

Signed-off-by: Ayush Shah <[email protected]>
…information about logins (both SQL and Windows) and users associated with those logins.

sp_helplogins [ [ @LoginNamePattern = ] N'LoginNamePattern' ] [ ; ]
@LoginNamePattern is sys.sysname, with a default of NULL . If specified, @loginnamepattern must exist.

It returns two result sets -
First view - information about all logins present on the server.
Second view - information about each login and its mapping with a user in a database or its membership with a database-role

Task - BABEL-5742

Signed-off-by: Ayush Shah <[email protected]>
…information about logins (both SQL and Windows) and users associated with those logins.

sp_helplogins [ [ @LoginNamePattern = ] N'LoginNamePattern' ] [ ; ]
@LoginNamePattern is sys.sysname, with a default of NULL . If specified, @loginnamepattern must exist.

It returns two result sets -
First view - information about all logins present on the server.
Second view - information about each login and its mapping with a user in a database or its membership with a database-role

Task - BABEL-5742

Signed-off-by: Ayush Shah <[email protected]>
…information about logins (both SQL and Windows) and users associated with those logins.

sp_helplogins [ [ @LoginNamePattern = ] N'LoginNamePattern' ] [ ; ]
@LoginNamePattern is sys.sysname, with a default of NULL . If specified, @loginnamepattern must exist.

It returns two result sets -
First view - information about all logins present on the server.
Second view - information about each login and its mapping with a user in a database or its membership with a database-role

Task - BABEL-5742

Signed-off-by: Ayush Shah <[email protected]>
…information about logins (both SQL and Windows) and users associated with those logins.

sp_helplogins [ [ @LoginNamePattern = ] N'LoginNamePattern' ] [ ; ]
@LoginNamePattern is sys.sysname, with a default of NULL . If specified, @loginnamepattern must exist.

It returns two result sets -
First view - information about all logins present on the server.
Second view - information about each login and its mapping with a user in a database or its membership with a database-role

Task - BABEL-5742

Signed-off-by: Ayush Shah <[email protected]>
…information about logins (both SQL and Windows) and users associated with those logins.

sp_helplogins [ [ @LoginNamePattern = ] N'LoginNamePattern' ] [ ; ]
@LoginNamePattern is sys.sysname, with a default of NULL . If specified, @loginnamepattern must exist.

It returns two result sets -
First view - information about all logins present on the server.
Second view - information about each login and its mapping with a user in a database or its membership with a database-role

Task - BABEL-5742

Signed-off-by: Ayush Shah <[email protected]>
…information about logins (both SQL and Windows) and users associated with those logins.

sp_helplogins [ [ @LoginNamePattern = ] N'LoginNamePattern' ] [ ; ]
@LoginNamePattern is sys.sysname, with a default of NULL . If specified, @loginnamepattern must exist.

It returns two result sets -
First view - information about all logins present on the server.
Second view - information about each login and its mapping with a user in a database or its membership with a database-role

Task - BABEL-5742

Signed-off-by: Ayush Shah <[email protected]>
@ayushdsh ayushdsh closed this May 26, 2025
@ayushdsh ayushdsh reopened this May 26, 2025
…information about logins (both SQL and Windows) and users associated with those logins.

sp_helplogins [ [ @LoginNamePattern = ] N'LoginNamePattern' ] [ ; ]
@LoginNamePattern is sys.sysname, with a default of NULL . If specified, @loginnamepattern must exist.

It returns two result sets -
First view - information about all logins present on the server.
Second view - information about each login and its mapping with a user in a database or its membership with a database-role

Task - BABEL-5742

Signed-off-by: Ayush Shah <[email protected]>
@ayushdsh ayushdsh closed this May 27, 2025
@ayushdsh ayushdsh reopened this May 27, 2025
@@ -39,6 +39,10 @@ go
drop user guest;
go

-- re-enabling connect on guest user
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this to fix intermittent test failures which is not related to your changes, right?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's correct. In this test, we are removing the guest user but never adding them back. This is to add the guest access back

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please think about cherry-picking this stabilizing changes to other branches as well if we are observing the same.

@@ -39,6 +39,10 @@ go
drop user guest;
go

-- re-enabling connect on guest user
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please think about cherry-picking this stabilizing changes to other branches as well if we are observing the same.

ayushdsh added 6 commits May 29, 2025 15:46
…information about logins (both SQL and Windows) and users associated with those logins.

sp_helplogins [ [ @LoginNamePattern = ] N'LoginNamePattern' ] [ ; ]
@LoginNamePattern is sys.sysname, with a default of NULL . If specified, @loginnamepattern must exist.

It returns two result sets -
First view - information about all logins present on the server.
Second view - information about each login and its mapping with a user in a database or its membership with a database-role

Task - BABEL-5742

Signed-off-by: Ayush Shah <[email protected]>
…information about logins (both SQL and Windows) and users associated with those logins.

sp_helplogins [ [ @LoginNamePattern = ] N'LoginNamePattern' ] [ ; ]
@LoginNamePattern is sys.sysname, with a default of NULL . If specified, @loginnamepattern must exist.

It returns two result sets -
First view - information about all logins present on the server.
Second view - information about each login and its mapping with a user in a database or its membership with a database-role

Task - BABEL-5742

Signed-off-by: Ayush Shah <[email protected]>
…information about logins (both SQL and Windows) and users associated with those logins.

sp_helplogins [ [ @LoginNamePattern = ] N'LoginNamePattern' ] [ ; ]
@LoginNamePattern is sys.sysname, with a default of NULL . If specified, @loginnamepattern must exist.

It returns two result sets -
First view - information about all logins present on the server.
Second view - information about each login and its mapping with a user in a database or its membership with a database-role

Task - BABEL-5742

Signed-off-by: Ayush Shah <[email protected]>
…information about logins (both SQL and Windows) and users associated with those logins.

sp_helplogins [ [ @LoginNamePattern = ] N'LoginNamePattern' ] [ ; ]
@LoginNamePattern is sys.sysname, with a default of NULL . If specified, @loginnamepattern must exist.

It returns two result sets -
First view - information about all logins present on the server.
Second view - information about each login and its mapping with a user in a database or its membership with a database-role

Task - BABEL-5742

Signed-off-by: Ayush Shah <[email protected]>
ayushdsh added 3 commits June 3, 2025 07:18
…smallmoney arithmetic and math functions.

There were certain issues found both w.r.t overflow handling and certain functions and operations giving incorrect result for money and smallmoney datatype. This commit addresses those issues.

Issue babelfish-for-postgresql#1: Overflow of smallmoney arithmetic leading to TDS hang.
Issue babelfish-for-postgresql#2: Unhandled overflow cases leading to incorrect output.
Issue babelfish-for-postgresql#3: Fixeddecimal operators being resolved for smallmoney functions and operations leading to incorrect results.

Task: BABEL-5745, BABEL-5757, BABEL-5756, BABEL-5747, BABEL-5754

Signed-off-by: Ayush Shah <[email protected]>
…smallmoney arithmetic and math functions.

There were certain issues found both w.r.t overflow handling and certain functions and operations giving incorrect result for money and smallmoney datatype. This commit addresses those issues.

Issue babelfish-for-postgresql#1: Overflow of smallmoney arithmetic leading to TDS hang.
Issue babelfish-for-postgresql#2: Unhandled overflow cases leading to incorrect output.
Issue babelfish-for-postgresql#3: Fixeddecimal operators being resolved for smallmoney functions and operations leading to incorrect results.

Task: BABEL-5745, BABEL-5757, BABEL-5756, BABEL-5747, BABEL-5754

Signed-off-by: Ayush Shah <[email protected]>
…information about logins (both SQL and Windows) and users associated with those logins.

sp_helplogins [ [ @LoginNamePattern = ] N'LoginNamePattern' ] [ ; ]
@LoginNamePattern is sys.sysname, with a default of NULL . If specified, @loginnamepattern must exist.

It returns two result sets -
First view - information about all logins present on the server.
Second view - information about each login and its mapping with a user in a database or its membership with a database-role

Task - BABEL-5742

Signed-off-by: Ayush Shah <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants