Skip to content

[26.0] Fix AmbiguousColumn error in job search for tools with long input names#22167

Open
mvdbeek wants to merge 2 commits intogalaxyproject:release_26.0from
mvdbeek:fix_ambigous_column_job_cache
Open

[26.0] Fix AmbiguousColumn error in job search for tools with long input names#22167
mvdbeek wants to merge 2 commits intogalaxyproject:release_26.0from
mvdbeek:fix_ambigous_column_job_cache

Conversation

@mvdbeek
Copy link
Member

@mvdbeek mvdbeek commented Mar 18, 2026

PostgreSQL truncates identifiers longer than 63 bytes (NAMEDATALEN). When two tool inputs share a long prefix differing only after the 63rd character (e.g. deeply nested JBrowse assemblies|track_groups|... parameters), their CTE column labels collide after truncation, causing psycopg2.errors.AmbiguousColumn.

Add safe_label() that falls back to a unique _input_{value_index} label when the formatted label exceeds 63 characters, and apply it to all 5 sites that generate column labels in the job search query builder.

Fixes #22166

How to test the changes?

(Select all options that apply)

  • I've included appropriate automated tests.
  • This is a refactoring of components with existing test coverage.
  • Instructions for manual testing are as follows:
    1. [add testing steps and prerequisites here if you didn't write automated tests covering all your changes]

License

  • I agree to license these and all my past contributions to the core galaxy codebase under the MIT license.

PostgreSQL truncates identifiers longer than 63 bytes (NAMEDATALEN).
When two tool inputs share a long prefix differing only after the 63rd
character (e.g. deeply nested JBrowse assemblies|track_groups|...
parameters), their CTE column labels collide after truncation, causing
psycopg2.errors.AmbiguousColumn.

Add safe_label() that falls back to a unique `_input_{value_index}`
label when the formatted label exceeds 63 characters, and apply it to
all 5 sites that generate column labels in the job search query builder.

Fixes galaxyproject#22166
@mvdbeek mvdbeek changed the base branch from dev to release_26.0 March 18, 2026 15:35
@mvdbeek mvdbeek changed the title Fix AmbiguousColumn error in job search for tools with long input names [26.0] Fix AmbiguousColumn error in job search for tools with long input names Mar 18, 2026
@github-actions github-actions bot added this to the 26.1 milestone Mar 18, 2026
@github-actions github-actions bot changed the title [26.0] Fix AmbiguousColumn error in job search for tools with long input names [26.0] Fix AmbiguousColumn error in job search for tools with long input names Mar 18, 2026
Copy link
Member

@dannon dannon left a comment

Choose a reason for hiding this comment

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

Is value_index guaranteed to be unique across different k values here? It resets to 0 for each key in the outer input_data.items() loop (line 550), so if two different long-named inputs each have one dataset, both would get fallback label _input_0.

value_index resets to 0 for each key in the input_data loop, so the
previous _input_{value_index} fallback could collide when two different
long-named inputs each had value_index=0. Use an md5 hash prefix of
the full label to ensure uniqueness.
@mvdbeek
Copy link
Member Author

mvdbeek commented Mar 19, 2026

That's a good point, 8c04986 should cover that.

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

Projects

Status: Needs Review

Development

Successfully merging this pull request may close these issues.

InternalError: (psycopg2.errors.InFailedSqlTransaction) current transaction is aborted, commands ignored until end of transaction block

2 participants