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

Postgres: fix corner case of NULL/empty arrays comparison for roles #38429

Merged
merged 1 commit into from
Feb 22, 2024

Conversation

Tener
Copy link
Contributor

@Tener Tener commented Feb 20, 2024

With automatic user provisioning enabled, when the user initiates a second connection to the database, we verify that their roles hasn't changed. If the current or upcoming set of roles are empty, the check returns incorrect results. This PR fixes the check by making sure we are working with empty arrays instead of NULLs, and checking the length of array using cardinality which returns 0 for empty arrays.

Changelog: Fixed Postgres issue preventing multiple connections for auto-provisioned users with no database roles.

Copy link

The PR changelog entry failed validation: Changelog entry not found in the PR body. Please add a "no-changelog" label to the PR, or changelog lines starting with changelog: followed by the changelog entries for the PR.

@Tener Tener requested a review from greedy52 February 20, 2024 15:14
Copy link
Contributor

@greedy52 greedy52 left a comment

Choose a reason for hiding this comment

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

LGTM. tested both positive and negative cases.

@Tener Tener added this pull request to the merge queue Feb 22, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to a conflict with the base branch Feb 22, 2024
@Tener Tener force-pushed the tener/postgres-no-roles-null-array branch from fa80528 to cdeda4c Compare February 22, 2024 13:42
@Tener Tener enabled auto-merge February 22, 2024 13:43
@Tener Tener added this pull request to the merge queue Feb 22, 2024
Merged via the queue into master with commit 2f069ed Feb 22, 2024
34 checks passed
@Tener Tener deleted the tener/postgres-no-roles-null-array branch February 22, 2024 14:05
@public-teleport-github-review-bot

@Tener See the table below for backport results.

Branch Result
branch/v13 Failed
branch/v14 Failed
branch/v15 Failed

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

Successfully merging this pull request may close these issues.

4 participants