Skip to content

relation "5_3" does not exist error when using pg_pathman with Citus #247

Closed
@hslightdb

Description

@hslightdb

Problem description

when used with pathman, SQL select from distribute table used Distributed Subplan 17_1 will report error.

CREATE TABLE t1 (id int, val int);
CREATE TABLE t2 (id int, val int);

SELECT create_distributed_table('t1', 'id');
SELECT create_distributed_table('t2', 'id');


xxx@postgres=# select*  from t1,(select* from t2 where id>10) as tt;
ERROR:  relation "17_1" does not exist
CONTEXT:  while executing command on 192.168.247.128:6432

it is because citus will send 'copy xxx FROM STDIN WITH (format result)' to datanode and pathman is loaded after citus. without pathman, citus will process 'copy from' specially, it will create xxx for copy. but with pathman, pathman will to get relid of xxx in is_pathman_related_copy function, because xxx is not exist, it will throw exception, then select failed.

stack:

RangeVarGetRelidExtended
is_pathman_related_copy
pathman_process_utility_hook

Is it ok to change is_pathman_related_copy func as follows ?

	parent_relid = RangeVarGetRelid(copy_stmt->relation,
                                                                        (copy_stmt->is_from ?
                                                                                PATHMAN_COPY_WRITE_LOCK :
                                                                                PATHMAN_COPY_READ_LOCK),
-                                                                       false);
-
+                                                                       true);
+       if (!OidIsValid(parent_relid))
+               return false;
+               
        /* Check that relation is partitioned */
        if (has_pathman_relation_info(parent_relid))
        {
(END)

Environment

....
....
22080 | pg_pathman         |       10 |         2200 | f              | 1.5        | {22082,22093
}             | {"",""}
(28 rows)

pg version 13.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions