From d1fdb4cdb9e5d56209e9ffe7d84067992ce7903e Mon Sep 17 00:00:00 2001 From: Shayan Golshani Date: Sun, 3 May 2026 16:02:47 -0400 Subject: [PATCH] Fix completion crash when tables are created during refresh --- AUTHORS | 1 + changelog.rst | 1 + pgcli/pgcompleter.py | 2 ++ 3 files changed, 4 insertions(+) diff --git a/AUTHORS b/AUTHORS index bf9a3b226..39a4281c8 100644 --- a/AUTHORS +++ b/AUTHORS @@ -147,6 +147,7 @@ Contributors: * Devadathan M B (devadathanmb) * Charalampos Stratakis * Laszlo Bimba (bimlas) + * Shayan Golshani (shgol) Creator: -------- diff --git a/changelog.rst b/changelog.rst index a6469b973..973592bdd 100644 --- a/changelog.rst +++ b/changelog.rst @@ -13,6 +13,7 @@ Bug fixes: ---------- * Add `VERSION` to built-in function completion so `SELECT VERSION();` is suggested. * Hide timezone notice at startup when local and server timezones are the same. +* Fix completion crash when tables are created during refresh. 4.4.0 (2025-12-24) ================== diff --git a/pgcli/pgcompleter.py b/pgcli/pgcompleter.py index ced0f1687..7430be3c4 100644 --- a/pgcli/pgcompleter.py +++ b/pgcli/pgcompleter.py @@ -229,6 +229,8 @@ def extend_columns(self, column_data, kind): has_default=has_default, default=default, ) + metadata.setdefault(schema, {}) + metadata[schema].setdefault(relname, OrderedDict()) metadata[schema][relname][colname] = column self.all_completions.add(colname)