Skip to content

Commit b3c3728

Browse files
authored
fix(truncate): include materialized views in TRUNCATE (#1751)
When MATERIALIZE VIEWS ... AS $$ ... $$ is used with WITH truncate, the materialized views are stored in schema-view-list (because fetch-columns is called with :table-type :view) rather than schema-table-list. truncate-tables only iterated over table-list, so the TRUNCATE statement was never generated for any matview — the summary showed 'Truncate: 0' even when truncate was requested. The COPY phase already does the right thing: optimize-table-copy-ordering uses (nconc table-list view-list). Align truncate-tables to match. Closes #1591.
1 parent 056c3fb commit b3c3728

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎src/pgsql/pgsql-create-schema.lisp‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,8 +302,10 @@
302302
must already be active when calling that function."
303303
(let* ((target-list (mapcar #'format-table-name
304304
(etypecase catalog-or-table
305-
(catalog (table-list catalog-or-table))
306-
(schema (table-list catalog-or-table))
305+
(catalog (append (table-list catalog-or-table)
306+
(view-list catalog-or-table)))
307+
(schema (append (table-list catalog-or-table)
308+
(view-list catalog-or-table)))
307309
(table (list catalog-or-table)))))
308310
(sql
309311
(when target-list

0 commit comments

Comments
 (0)