Skip to content
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

mycat如何处理sql中包含with as子查询的情况 #807

Open
xuge233 opened this issue Jul 17, 2023 · 1 comment
Open

mycat如何处理sql中包含with as子查询的情况 #807

xuge233 opened this issue Jul 17, 2023 · 1 comment

Comments

@xuge233
Copy link

xuge233 commented Jul 17, 2023

SQL:
WITH tUser AS (SELECT id,tenant_id FROM sys_user WHERE phone = XXXX AND del_flag = 0)select * from tUser
报错:

1146 - Table 'neuron.tUser' doesn't exist
时间: 0.006s
猜测:
是否是因为with as子查询和select * from tUser使用的不是同一个session,导致with as子查询结束之后,session关闭,子查询内容也随之清空,导致后续select语句找不到表。

@apachemycat
Copy link

neuron.tUser,可以explain 看看,这个SQL路由到那个分片,这个分片上是否有这个表和库存在

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