Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
hslightdb opened this issue Apr 7, 2022 · 1 comment
Closed

Comments

@hslightdb
Copy link

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

kovdb75 added a commit that referenced this issue May 18, 2022
Changed lock order for MERGE of range partitions + change for issue #247
@kovdb75
Copy link
Collaborator

kovdb75 commented May 18, 2022

@hslightdb, thanks!
Your changes merged into master branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants