Repository navigation
Conversation
A numeric column appended float and then, through the fall-through else, str as well, so every column after it carried the wrong type and the integer format skipped the ints that followed a numeric. Only the auto-vertical fallback with float_format or integer_format set was affected.
cli_helpers infers a column's type from its values when none is given, and its ranking files float and Decimal alike under Decimal, which neither format_numbers nor align_decimals treats as a number. So the float format of [data_formats] never applied, and float and numeric columns were never aligned on the decimal point; the types pgcli did compute came after list(cur) had dropped the description, so they were always None. The types now come from the cursor description before the rows are materialised, and go to both the table and the auto-vertical fallback.
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.
The
floatformat of[data_formats]has never applied, and float and numeric columns were never aligned on the decimal point. Two things combine:format_output()computescolumn_typesfrom the cursor description only aftercur = list(cur)has dropped it, so they are alwaysNoneand cli_helpers infers the types from the values.TYPESranksfloatandDecimalboth as 3, and_get_column_type()inverts that dict, so every float or numeric column comes back asDecimal, which neitherformat_numbersnoralign_decimalstreats as a number (both testcolumn_type is float). This goes back to cli_helpers 1.0.0.The types now come from the cursor description before the rows are materialised (
float4/float8/numericas float,int2/int4/int8as int) and go to both the table and the auto-vertical fallback. Withfloat = ",.2f"in the config123456.78prints as123,456.78; with no float format, the numbers of a float or numeric column line up on the decimal point. The first commit also fixes the type list itself, which appended two entries for a numeric column.Four tests against a live server, all failing on
main. The whole suite passes excepttest_format_array_output_expanded, red onmainbefore this change (cli-helpers 2.15.2, see #1653).