Skip to content

pgaadauth_sync_roles_for_group_members aborts if there's a login that exceeds the role name length #137

Description

When running SELECT * FROM pgaadauth_sync_roles_for_group_members(); and there's a really long identity, example:

[mylongname.user_long-company-inc.biz#EXT#@contoso.onmicrosoft.com]

It gets truncated to 64 characters the first time and completes with success. Running again will end with the following error:

NOTICE: identifier "mylongname.user_long-company-inc.biz#EXT#@contoso.onmicrosoft.com" will be truncated to "mylongname.user_long-company-inc.biz#EXT#@contoso.onmicrosoft.c"
role "mylongname.user_long-company-inc.biz#EXT#@contoso.onmicrosoft.c" already exists
CONTEXT: SQL statement "CREATE ROLE "mylongname.user_long-company-inc.biz#EXT#@contoso.onmicrosoft.com" LOGIN"
PL/pgSQL function pgaadauth_upsert_role(text,boolean) line 13 at EXECUTE
SQL statement "SELECT pgaadauth_upsert_role(
new_role_name,
current_row.is_any_group_admin)"
PL/pgSQL function pgaadauth_sync_roles_for_group_members() line 80 at PERFORM
Total execution time: 00:00:01.035

Additional users will no longer get synced.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions