Amit Langote <langote_amit...@lab.ntt.co.jp> writes:
> The infamous missing-relkind-check in heap_truncate() seems to be behind
> this.  Perhaps, a patch like the attached will do?

That seems excessively restrictive.  Anything that has storage (e.g.
matviews) ought to be truncatable, no?

I thought we had a macro or utility function somewhere that knew which
relkinds have storage, though I can't find it right now.  I'd be
inclined to instantiate that if it doesn't exist, and then the code
here ought to read something like

        if (RelkindHasStorage(rel->rd_rel->relkind))
                heap_truncate_one_rel(rel);

Also, possibly the test ought to be inside heap_truncate_one_rel
rather than its callers?

                        regards, tom lane

Reply via email to