On 2018/09/12 19:29, Rajkumar Raghuwanshi wrote:
> Hi,
> 
> I am getting below error while creating temp root partition table with on
> commit. getting same error from v10 onwards.
> 
> [edb@localhost bin]$ ./psql postgres
> psql (10.5)
> Type "help" for help.
> 
> postgres=# CREATE TEMP TABLE test ( c1 varchar, c2 int) PARTITION BY RANGE
> (c1) ON COMMIT DELETE ROWS;
> ERROR:  could not open file "base/13164/t3_16388": No such file or directory

Oops, good catch.

The infamous missing-relkind-check in heap_truncate() seems to be behind
this.  Perhaps, a patch like the attached will do?

Thanks,
Amit
diff --git a/src/backend/catalog/heap.c b/src/backend/catalog/heap.c
index 9176f6280b..3f0be39940 100644
--- a/src/backend/catalog/heap.c
+++ b/src/backend/catalog/heap.c
@@ -3174,7 +3174,8 @@ heap_truncate(List *relids)
                Relation        rel = lfirst(cell);
 
                /* Truncate the relation */
-               heap_truncate_one_rel(rel);
+               if (rel->rd_rel->relkind == RELKIND_RELATION)
+                       heap_truncate_one_rel(rel);
 
                /* Close the relation, but keep exclusive lock on it until 
commit */
                heap_close(rel, NoLock);

Reply via email to