Skip to content

Conversation

@acwhite211
Copy link
Member

@acwhite211 acwhite211 commented Nov 5, 2025

Fixes #7510

Fixes issue found in v7.11.3 testing where on the KUBirds database, the CO catalog number formatted field was displaying results as numbers without leading zeros, like 1 instead of this 000000001.

The issue introduced by recent refactoring of query-building defaults where the generated SQL for CatalogNumber fields wrapped the numeric cast expression inside IFNULL(...) rather than the raw column.

The ObjectFormatter.make_expr() method always wrapped the formatted expression in blank_nulls(...), even after _fieldformat() applied the numeric cast for CatalogNumber. After refactoring to use a fresh DefaultQueryFormatterProps(), the numeric_catalog_number flag was applied earlier, allowing the change in the generated SQL.

Here is the formatted catalog number in the query before:

IFNULL(CAST(collectionobject.`CatalogNumber` AS DECIMAL(65)), '') AS blank_nulls_1

And here it is after the changes in this PR:

IFNULL(collectionobject.`CatalogNumber`, '') AS blank_nulls_1

Checklist

  • Self-review the PR after opening it to make sure the changes look good and
    self-explanatory (or properly documented)
  • Add relevant issue to release milestone

Testing instructions

  • Use the KUBrids database
  • Open the QB for CO and run a query with catalog number formatted.
  • See that the query results for the formatted catalog number have leading zeros.

Copy link
Contributor

@Gitesh307 Gitesh307 left a comment

Choose a reason for hiding this comment

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

Looks good! Verified on KU Birds, formatted catalog numbers now keep leading zeros in query results.

Copy link

@Iwantexpresso Iwantexpresso left a comment

Choose a reason for hiding this comment

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

Use the KUBrids database
Open the QB for CO and run a query with catalog number formatted.

  • See that the query results for the formatted catalog number have leading zeros.

Tested on KuBirds as requested, and sd_paleo It looks like the issue has persisted, I also tested it on bohart_entomology's pinned insects collection and it is at least working fine there.

@github-project-automation github-project-automation bot moved this from 📋Back Log to Dev Attention Needed in General Tester Board Nov 5, 2025
@acwhite211
Copy link
Member Author

Couldn't recreate the issue on sd_paleo or KUBirds for this branch.
image
image

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

Labels

None yet

Projects

Status: Dev Attention Needed

4 participants