Azure / Azure/azure-postgresql
pgaadauth_sync_roles_for_group_members aborts if there's a login that exceeds the role name length
- Dominant language
- Bicep
- Stars
- 87
- Forks
- 81
- PR merge metrics
- No merged PRs in 30d
Description
When running `SELECT * FROM pgaadauth_sync_roles_for_group_members();` and there's a really long identity, example:
```sql
[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:
```sql
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.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.