{"action":"created","issue":{"url":"https://api.github.com/repos/ADBSQL/AntDB/issues/51","repository_url":"https://api.github.com/repos/ADBSQL/AntDB","labels_url":"https://api.github.com/repos/ADBSQL/AntDB/issues/51/labels{/name}","comments_url":"https://api.github.com/repos/ADBSQL/AntDB/issues/51/comments","events_url":"https://api.github.com/repos/ADBSQL/AntDB/issues/51/events","html_url":"https://github.com/ADBSQL/AntDB/issues/51","id":283428050,"number":51,"title":"打开enable_cluster_plan，delete数据时，条件中表和物化视图join，报错","user":{"login":"mass3","id":19543186,"avatar_url":"https://avatars0.githubusercontent.com/u/19543186?v=4","gravatar_id":"","url":"https://api.github.com/users/mass3","html_url":"https://github.com/mass3","followers_url":"https://api.github.com/users/mass3/followers","following_url":"https://api.github.com/users/mass3/following{/other_user}","gists_url":"https://api.github.com/users/mass3/gists{/gist_id}","starred_url":"https://api.github.com/users/mass3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mass3/subscriptions","organizations_url":"https://api.github.com/users/mass3/orgs","repos_url":"https://api.github.com/users/mass3/repos","events_url":"https://api.github.com/users/mass3/events{/privacy}","received_events_url":"https://api.github.com/users/mass3/received_events","type":"User","site_admin":false},"labels":[{"id":770920106,"url":"https://api.github.com/repos/ADBSQL/AntDB/labels/ADB_3.1","name":"ADB_3.1","color":"d4c5f9","default":false},{"id":724405560,"url":"https://api.github.com/repos/ADBSQL/AntDB/labels/bug","name":"bug","color":"ee0701","default":true}],"state":"closed","locked":false,"assignee":{"login":"hsiaoby","id":32889522,"avatar_url":"https://avatars2.githubusercontent.com/u/32889522?v=4","gravatar_id":"","url":"https://api.github.com/users/hsiaoby","html_url":"https://github.com/hsiaoby","followers_url":"https://api.github.com/users/hsiaoby/followers","following_url":"https://api.github.com/users/hsiaoby/following{/other_user}","gists_url":"https://api.github.com/users/hsiaoby/gists{/gist_id}","starred_url":"https://api.github.com/users/hsiaoby/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hsiaoby/subscriptions","organizations_url":"https://api.github.com/users/hsiaoby/orgs","repos_url":"https://api.github.com/users/hsiaoby/repos","events_url":"https://api.github.com/users/hsiaoby/events{/privacy}","received_events_url":"https://api.github.com/users/hsiaoby/received_events","type":"User","site_admin":false},"assignees":[{"login":"hsiaoby","id":32889522,"avatar_url":"https://avatars2.githubusercontent.com/u/32889522?v=4","gravatar_id":"","url":"https://api.github.com/users/hsiaoby","html_url":"https://github.com/hsiaoby","followers_url":"https://api.github.com/users/hsiaoby/followers","following_url":"https://api.github.com/users/hsiaoby/following{/other_user}","gists_url":"https://api.github.com/users/hsiaoby/gists{/gist_id}","starred_url":"https://api.github.com/users/hsiaoby/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hsiaoby/subscriptions","organizations_url":"https://api.github.com/users/hsiaoby/orgs","repos_url":"https://api.github.com/users/hsiaoby/repos","events_url":"https://api.github.com/users/hsiaoby/events{/privacy}","received_events_url":"https://api.github.com/users/hsiaoby/received_events","type":"User","site_admin":false}],"milestone":null,"comments":0,"created_at":"2017-12-20T02:13:51Z","updated_at":"2018-02-02T08:04:56Z","closed_at":"2018-02-02T08:04:56Z","author_association":"MEMBER","body":"\r\n### 创建表和物化视图，然后从表中删除数据，条件中视图和表join，报错。\r\n```\r\npostgres=# CREATE TABLE mvtest_v AS SELECT generate_series(1,10) AS a;\r\nCREATE MATERIALIZED VIEW mvtest_mv_v AS SELECT a FROM mvtest_v WHERE a <= 5;\r\nDELETE FROM mvtest_v WHERE EXISTS ( SELECT * FROM mvtest_mv_v WHERE mvtest_mv_v.a = mvtest_v.a );\r\nINSERT 0 10\r\npostgres=# CREATE MATERIALIZED VIEW mvtest_mv_v AS SELECT a FROM mvtest_v WHERE a <= 5;\r\nSELECT 5\r\npostgres=# DELETE FROM mvtest_v WHERE EXISTS ( SELECT * FROM mvtest_mv_v WHERE mvtest_mv_v.a = mvtest_v.a );\r\nERROR:  could not open relation with OID 25047\r\n\r\n把enable_cluster_plan关掉，delete成功：\r\n\r\npostgres=# set enable_cluster_plan = off;\r\nSET\r\npostgres=# DELETE FROM mvtest_v WHERE EXISTS ( SELECT * FROM mvtest_mv_v WHERE mvtest_mv_v.a = mvtest_v.a );\r\nDELETE 5\r\npostgres=# \r\n```\r\n\r\n### 测试SQL：\r\n```\r\nCREATE TABLE mvtest_v AS SELECT generate_series(1,10) AS a;\r\nCREATE MATERIALIZED VIEW mvtest_mv_v AS SELECT a FROM mvtest_v WHERE a <= 5;\r\nDELETE FROM mvtest_v WHERE EXISTS ( SELECT * FROM mvtest_mv_v WHERE mvtest_mv_v.a = mvtest_v.a );\r\n```"},"comment":{"url":"https://api.github.com/repos/ADBSQL/AntDB/issues/comments/362514262","html_url":"https://github.com/ADBSQL/AntDB/issues/51#issuecomment-362514262","issue_url":"https://api.github.com/repos/ADBSQL/AntDB/issues/51","id":362514262,"user":{"login":"mass3","id":19543186,"avatar_url":"https://avatars0.githubusercontent.com/u/19543186?v=4","gravatar_id":"","url":"https://api.github.com/users/mass3","html_url":"https://github.com/mass3","followers_url":"https://api.github.com/users/mass3/followers","following_url":"https://api.github.com/users/mass3/following{/other_user}","gists_url":"https://api.github.com/users/mass3/gists{/gist_id}","starred_url":"https://api.github.com/users/mass3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mass3/subscriptions","organizations_url":"https://api.github.com/users/mass3/orgs","repos_url":"https://api.github.com/users/mass3/repos","events_url":"https://api.github.com/users/mass3/events{/privacy}","received_events_url":"https://api.github.com/users/mass3/received_events","type":"User","site_admin":false},"created_at":"2018-02-02T08:04:56Z","updated_at":"2018-02-02T08:04:56Z","author_association":"MEMBER","body":"问题已经解决\r\n```\r\npostgres=# CREATE TABLE mvtest_v AS SELECT generate_series(1,10) AS a;\r\nCREATE MATERIALIZED VIEW mvtest_mv_v AS SELECT a FROM mvtest_v WHERE a <= 5;\r\nDELETE FROM mvtest_v WHERE EXISTS ( SELECT * FROM mvtest_mv_v WHERE mvtest_mv_v.a = mvtest_v.a );\r\nINSERT 0 10\r\npostgres=# CREATE MATERIALIZED VIEW mvtest_mv_v AS SELECT a FROM mvtest_v WHERE a <= 5;\r\nSELECT 5\r\npostgres=# DELETE FROM mvtest_v WHERE EXISTS ( SELECT * FROM mvtest_mv_v WHERE mvtest_mv_v.a = mvtest_v.a );\r\nDELETE 5\r\n```"}}
{"actor":{"display_login":"mass3"}}