Skip to content

Treat pg_users.user_sysid as uint rather than int#5057

Merged
roji merged 1 commit intonpgsql:mainfrom
rafiss:fix-get-users
May 16, 2023
Merged

Treat pg_users.user_sysid as uint rather than int#5057
roji merged 1 commit intonpgsql:mainfrom
rafiss:fix-get-users

Conversation

@rafiss
Copy link
Copy Markdown
Contributor

@rafiss rafiss commented May 11, 2023

The data in this field can be in the range of 0 to 4,294,967,295. Before this patch, if there was a value larger than 2,147,483,647 this operation would fail with the following error.

System.ArgumentException : Value was either too large or too small for an Int32.Couldn't store <3233629770> in user_sysid Column.  Expected type is Int32.
   at System.Data.DataColumn.set_Item(Int32 record, Object value)
   at System.Data.DataTable.NewRecordFromArray(Object[] value)
   at System.Data.DataTable.LoadDataRow(Object[] values, Boolean fAcceptChanges)
   at Npgsql.NpgsqlDataAdapter.Fill(DataTable dataTable, NpgsqlDataReader dataReader, Boolean async, CancellationToken cancellationToken) in /mnt/data1/npgsql/src/Npgsql/NpgsqlDataAdapter.cs:line 199
   at Npgsql.NpgsqlDataAdapter.Fill(DataTable dataTable, Boolean async, CancellationToken cancellationToken) in /mnt/data1/npgsql/src/Npgsql/NpgsqlDataAdapter.cs:line 158
   at Npgsql.NpgsqlDataAdapter.Fill(DataTable dataTable, Boolean async, CancellationToken cancellationToken) in /mnt/data1/npgsql/src/Npgsql/NpgsqlDataAdapter.cs:line 166
   at Npgsql.NpgsqlSchema.GetUsers(NpgsqlConnection conn, String[] restrictions, Boolean async, CancellationToken cancellationToken) in /mnt/data1/npgsql/src/Npgsql/NpgsqlSchema.cs:line 304
   at Npgsql.Tests.SchemaTests.GetSchema(NpgsqlConnection conn, String collectionName) in /mnt/data1/npgsql/test/Npgsql.Tests/SchemaTests.cs:line 545

The data in this field can be in the range of 0 to 4,294,967,295. Before
this patch, if there was a value larger than 2,147,483,647 this
operation would fail with the following error.

System.ArgumentException : Value was either too large or too small for an Int32.Couldn't store <3233629770> in user_sysid Column.  Expected type is Int32.
   at System.Data.DataColumn.set_Item(Int32 record, Object value)
   at System.Data.DataTable.NewRecordFromArray(Object[] value)
   at System.Data.DataTable.LoadDataRow(Object[] values, Boolean fAcceptChanges)
   at Npgsql.NpgsqlDataAdapter.Fill(DataTable dataTable, NpgsqlDataReader dataReader, Boolean async, CancellationToken cancellationToken) in /mnt/data1/npgsql/src/Npgsql/NpgsqlDataAdapter.cs:line 199
   at Npgsql.NpgsqlDataAdapter.Fill(DataTable dataTable, Boolean async, CancellationToken cancellationToken) in /mnt/data1/npgsql/src/Npgsql/NpgsqlDataAdapter.cs:line 158
   at Npgsql.NpgsqlDataAdapter.Fill(DataTable dataTable, Boolean async, CancellationToken cancellationToken) in /mnt/data1/npgsql/src/Npgsql/NpgsqlDataAdapter.cs:line 166
   at Npgsql.NpgsqlSchema.GetUsers(NpgsqlConnection conn, String[] restrictions, Boolean async, CancellationToken cancellationToken) in /mnt/data1/npgsql/src/Npgsql/NpgsqlSchema.cs:line 304
   at Npgsql.Tests.SchemaTests.GetSchema(NpgsqlConnection conn, String collectionName) in /mnt/data1/npgsql/test/Npgsql.Tests/SchemaTests.cs:line 545
@rafiss rafiss requested review from roji and vonzshik as code owners May 11, 2023 21:24
Copy link
Copy Markdown
Member

@roji roji left a comment

Choose a reason for hiding this comment

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

Thanks @rafiss, will backport this fix to older versions too.

@roji roji merged commit 60c4f52 into npgsql:main May 16, 2023
@roji roji added this to the 7.0.6 milestone May 16, 2023
@roji roji added the bug label May 16, 2023
roji pushed a commit that referenced this pull request May 16, 2023
@roji
Copy link
Copy Markdown
Member

roji commented May 16, 2023

Backported to 7.0.6 via 8acf7cd
Backported to 6.0.10 via be573ee

roji pushed a commit that referenced this pull request May 16, 2023
@rafiss rafiss deleted the fix-get-users branch June 5, 2023 03:42
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.

2 participants