Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ Contributors:
* Pieter Ouwerkerk (pouwerkerk)
* VXNCXNX
* Wei-Lun Li (b84330808)
* Jay Hemnani

* jackwalkerlabs (Codex-assisted)

Expand Down
3 changes: 3 additions & 0 deletions changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ Bug fixes:
created by ``uv venv``.
* Read ``alias_map_file`` as UTF-8 (with or without a BOM) instead of the
locale encoding, which made non-ASCII aliases fail on Windows.
* Show array columns in Postgres format (``{a,b}``) with the default
settings. They were shown as Python lists (``['a', 'b']``) unless a
``float`` format was set in ``[data_formats]``.

Internal:
---------
Expand Down
2 changes: 1 addition & 1 deletion pgcli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2214,7 +2214,7 @@ def format_status(cur, status):
"max_field_width": settings.max_field_width,
}
if not settings.floatfmt:
output_kwargs["preprocessors"] = (align_decimals,)
output_kwargs["preprocessors"] = (align_decimals, format_arrays)

if settings.column_date_formats:
output_kwargs["preprocessors"] += (format_timestamps,)
Expand Down
6 changes: 6 additions & 0 deletions tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ def test_format_output():
assert list(results) == expected


def test_format_output_arrays_without_float_format():
settings = OutputSettings(table_format="psql")
results = format_output("", [(["a", "b"],)], ["tags"], "", settings)
assert "| {a,b} |" in list(results)


def test_column_date_formats():
settings = OutputSettings(
table_format="psql",
Expand Down
Loading