Skip to content

[Bug]: Pagination fails on a table with a 19-digit bigint primary key. #3856

Open

Description

What happened?

Table: JotForm.Submission, PK JTF_SUB_ID BIGINT
Last key on page 1: 5123692796229827916
FieldValue in the returned cursor (Base64 decoded): 5.123692796229828E+18

Repro:

  1. GET /api/JotFormSubmission?$first=3&$select=JTF_SUB_ID
  2. GET the returned nextLink

Result of step 2:
400 BadRequest: Parameter "5.123692796229828E+18" cannot be resolved as column "JTF_SUB_ID" with type "Int64".

The MCP read_records tool returns the same cursor and the same error when that cursor is passed as "after".

Expected: Page 2 returns the next 3 rows.

Version

Microsoft.DataApiBuilder 2.1.5+cd004dbc2ce814ddf45883a8a76ce324fa668eeb

What database are you using?

Azure SQL

What hosting model are you using?

Local (including CLI)

Which API approach are you accessing DAB through?

REST

Relevant log output

fail: Azure.DataApiBuilder.Service.Controllers.RestController[0]
      1bb41aaf-1ea5-4394-8041-997247f66a06 Error handling REST request.
      Azure.DataApiBuilder.Service.Exceptions.DataApiBuilderException: Parameter "5.123692796229828E+18" cannot be resolved as column "JTF_SUB_ID" with type "Int64".
       ---> System.FormatException: The input string '5.123692796229828E+18' was not in a correct format.
         at System.Number.ThrowFormatException[TChar](ReadOnlySpan`1 value)
         at System.Int64.Parse(String s)
         at Azure.DataApiBuilder.Core.Resolvers.BaseSqlQueryStructure.ParseParamAsSystemType(String param, Type systemType) in /_/src/Core/Resolvers/Sql Query Structures/BaseSqlQueryStructure.cs:line 464
         at Azure.DataApiBuilder.Core.Resolvers.BaseSqlQueryStructure.GetParamAsSystemType(String fieldValue, String fieldName, Type systemType) in /_/src/Core/Resolvers/Sql Query Structures/BaseSqlQueryStructure.cs:line 685
         --- End of inner exception stack trace ---
         at Azure.DataApiBuilder.Core.Resolvers.BaseSqlQueryStructure.GetParamAsSystemType(String fieldValue, String fieldName, Type systemType) in /_/src/Core/Resolvers/Sql Query Structures/BaseSqlQueryStructure.cs:line 719
         at Azure.DataApiBuilder.Core.Resolvers.SqlQueryStructure.AddPaginationPredicate(IEnumerable`1 afterJsonValues) in /_/src/Core/Resolvers/Sql Query Structures/SqlQueryStructure.cs:line 665
         at Azure.DataApiBuilder.Core.Resolvers.SqlQueryStructure..ctor(RestRequestContext context, ISqlMetadataProvider sqlMetadataProvider, IAuthorizationResolver authorizationResolver, RuntimeConfigProvider runtimeConfigProvider, GQLFilterParser gQLFilterParser, HttpContext httpContext) in /_/src/Core/Resolvers/Sql Query Structures/SqlQueryStructure.cs:line 329
         at Azure.DataApiBuilder.Core.Resolvers.SqlQueryEngine.ExecuteAsync(FindRequestContext context) in /_/src/Core/Resolvers/SqlQueryEngine.cs:line 185
         at Azure.DataApiBuilder.Core.Services.RestService.DispatchQuery(RestRequestContext context, DatabaseType databaseType) in /_/src/Core/Services/RestService.cs:line 238
         at Azure.DataApiBuilder.Core.Services.RestService.ExecuteAsync(String entityName, EntityActionOperation operationType, String primaryKeyRoute) in /_/src/Core/Services/RestService.cs:line 213
         at Azure.DataApiBuilder.Service.Controllers.RestController.HandleOperation(String route, EntityActionOperation operationType) in /_/src/Service/Controllers/RestController.cs:line 278

Code of Conduct

  • I agree to follow this project's Code of Conduct
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

    bugSomething isn't workingtriageissues to be triaged

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions