django - 找不到无法重命名表的原因
问题描述
该问题的原因可能是什么:
Applying django_orm.0002_rename_tables_...Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 86, in _execute
return self.cursor.execute(sql, params)
psycopg2.errors.SyntaxError: syntax error at or near "."
"fergo"."tb_kel" RENAME TO "fergo"."tb_kelo"
"fergo"."tb_sa" RENAME TO "fergo"."tb_sartop"
肯定没有错字或语法错误之类的。所有要重命名的表都会出现此错误。有什么想法吗?
解决方案
问题是这样的:
alter table public.shoes rename to public.shoe_test;
ERROR: syntax error at or near "."
LINE 1: alter table public.shoes rename to public.shoe_test;
alter table public.shoes rename to shoe_test;
ALTER TABLE
您不能架构限定新名称。
如果您想要更改架构,那么您需要使用:
ALTER TABLE [ IF EXISTS ] name
SET SCHEMA new_schema
推荐阅读
- reactjs - '{ image: string; 类型中缺少属性 'children' 金额:数量;}' 但在“BannerLayer”类型中是必需的。TS2741
- angular - Angular 8 HttpClient 调用发布
- maven - 使用 maven 在不同的环境中运行 RestAssured 烟雾测试,并使用自己独特的 API 密钥作为标头
- c++ - 如果我的 2d 向量大小为 0,我会返回什么
- python-requests - 如何使用 python 请求登录网站
- excel - 循环工作表并将值复制到范围
- python - For 循环在停止之前总是运行 2 次
- python - 是否可以逐部分训练深度神经网络的输入
- python-3.x - 从 googleapiclient.discovery 导入构建 ModuleNotFoundError:没有名为“googleclient”的模块
- python - Dataset.from_generator 无法复制 numpy 数组的功能作为 1D Convnet 的输入