Repository navigation
Conversation
Updated changelog to include new feature for handling table names in FROM lists.
Add parameterized test for identifier column completions with various table combinations.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
extract_tableshandled the first table inFROM a, bdifferently from a single table. In the comma-separated branch ofextract_table_identifiers, anIdentifierListitem read the name, schema and alias straight from sqlparse (get_real_name,get_parent_name,get_alias) instead of usingparse_identifier, which the single-table path uses to normalize them. Unquoted upper-case names such asUSERStherefore kept their case in a list but were folded tousersas a single table, soSELECT from USERS, ORDERScompleted no columns whileSELECT from users, ordersdid.This calls
parse_identifierin that branch, so both paths return the sameTableReference. The change is 3 lines inpgcli/packages/parseutils/tables.py.Tests:
extract_tablesfor a comma list equals the combined results for each table alone (plain andPUBLIC.-qualified upper-case names, and quoted identifiers), and column completion for upper-case and quoted names in a comma list matches the single-table case (text and display_meta).Behavior note: quoted names in a comma list now go through the same normalization as the single-table and
CROSS JOINpaths, so the reference text for them can differ from what the comma path returned before.Checklist
changelog.rst.AUTHORSfile (or it's already there).pip install pre-commit && pre-commit install). I did not install the hooks. I ranruff checkandruff format --check(ruff 0.14.10, the version pinned in.pre-commit-config.yaml) on the repository and both pass.pytest testson Linux with Python 3.10.12: without the change, the new tests give 38 failures; with it, 2751 passed, 134 skipped, 1 xfailed. Tests that need a PostgreSQL server, the behave tests and the CI matrix were not run.