Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/hibernate/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python django.db.utils.ProgrammingError:列am.amcanorder不存在_Python_Django_Postgresql - Fatal编程技术网

Python django.db.utils.ProgrammingError:列am.amcanorder不存在

Python django.db.utils.ProgrammingError:列am.amcanorder不存在,python,django,postgresql,Python,Django,Postgresql,我使用PostgreSQL作为数据库,并使用django租户模式。但是,当我运行以下命令时,我得到的错误是 (checkpoint_env) G:\Django_Projects\RackNole\checkpoint_shashi_2\checkpoint_shashi_2>python manage.py migrate_schemas --shared System check identified some issues: WARNINGS: checkpoint.Multi

我使用PostgreSQL作为数据库,并使用django租户模式。但是,当我运行以下命令时,我得到的错误是

(checkpoint_env) 

G:\Django_Projects\RackNole\checkpoint_shashi_2\checkpoint_shashi_2>python manage.py migrate_schemas --shared
System check identified some issues:

WARNINGS:
checkpoint.MultiSelectResponse.response: (fields.W340) null has no effect on ManyToManyField.
=== Running migrate for schema public
System check identified some issues:

WARNINGS:
checkpoint.MultiSelectResponse.response: (fields.W340) null has no effect on ManyToManyField.
Operations to perform:
  Apply all migrations: website, checkpoint, account, django_comments, redirects, core, admin, twitter, galleries, tastypie, customers, auth, sites, blog, generic, contenttypes, sessions, conf, forms, pages, socialaccount
Running migrations:
  Rendering model states... DONE
  Applying core.0002_auto_20150414_2140...Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "G:\Py_Envs\Racknole\checkpoint_env\lib\site-packages\django\core\management\__init__.py", line 350, in execute_from_command_line
    utility.execute()
  File "G:\Py_Envs\Racknole\checkpoint_env\lib\site-packages\django\core\management\__init__.py", line 342, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "G:\Py_Envs\Racknole\checkpoint_env\lib\site-packages\django\core\management\base.py", line 348, in run_from_argv
    self.execute(*args, **cmd_options)
  File "G:\Py_Envs\Racknole\checkpoint_env\lib\site-packages\django\core\management\base.py", line 399, in execute
    output = self.handle(*args, **options)
  File "G:\Py_Envs\Racknole\checkpoint_env\lib\site-packages\tenant_schemas\management\commands\migrate_schemas.py", line 42, in handle
    self.run_migrations(self.schema_name, settings.SHARED_APPS)
  File "G:\Py_Envs\Racknole\checkpoint_env\lib\site-packages\tenant_schemas\management\commands\migrate_schemas.py", line 65, in run_migrations
    command.execute(*self.args, **self.options)
  File "G:\Py_Envs\Racknole\checkpoint_env\lib\site-packages\django\core\management\base.py", line 399, in execute
    output = self.handle(*args, **options)
  File "G:\Py_Envs\Racknole\checkpoint_env\lib\site-packages\django\core\management\commands\migrate.py", line 200, in handle
    executor.migrate(targets, plan, fake=fake, fake_initial=fake_initial)
  File "G:\Py_Envs\Racknole\checkpoint_env\lib\site-packages\django\db\migrations\executor.py", line 92, in migrate
    self._migrate_all_forwards(plan, full_plan, fake=fake, fake_initial=fake_initial)
  File "G:\Py_Envs\Racknole\checkpoint_env\lib\site-packages\django\db\migrations\executor.py", line 121, in _migrate_all_forwards
    state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
  File "G:\Py_Envs\Racknole\checkpoint_env\lib\site-packages\django\db\migrations\executor.py", line 198, in apply_migration
    state = migration.apply(state, schema_editor)
  File "G:\Py_Envs\Racknole\checkpoint_env\lib\site-packages\django\db\migrations\migration.py", line 123, in apply
    operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
  File "G:\Py_Envs\Racknole\checkpoint_env\lib\site-packages\django\db\migrations\operations\fields.py", line 201, in database_forwards
    schema_editor.alter_field(from_model, from_field, to_field)
  File "G:\Py_Envs\Racknole\checkpoint_env\lib\site-packages\django\db\backends\base\schema.py", line 482, in alter_field
    old_db_params, new_db_params, strict)
  File "G:\Py_Envs\Racknole\checkpoint_env\lib\site-packages\django\db\backends\base\schema.py", line 491, in _alter_field
    fk_names = self._constraint_names(model, [old_field.column], foreign_key=True)
  File "G:\Py_Envs\Racknole\checkpoint_env\lib\site-packages\django\db\backends\base\schema.py", line 911, in _constraint_names
    constraints = self.connection.introspection.get_constraints(cursor, model._meta.db_table)
  File "G:\Py_Envs\Racknole\checkpoint_env\lib\site-packages\tenant_schemas\postgresql_backend\introspection.py", line 287, in get_constraints
    'table': table_name,
  File "G:\Py_Envs\Racknole\checkpoint_env\lib\site-packages\django\db\backends\utils.py", line 79, in execute
    return super(CursorDebugWrapper, self).execute(sql, params)
  File "G:\Py_Envs\Racknole\checkpoint_env\lib\site-packages\django\db\backends\utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "G:\Py_Envs\Racknole\checkpoint_env\lib\site-packages\django\db\utils.py", line 95, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "G:\Py_Envs\Racknole\checkpoint_env\lib\site-packages\django\db\backends\utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: column am.amcanorder does not exist
LINE 13:                         WHEN am.amcanorder THEN
(检查点环境)
G:\Django\u Projects\RackNole\checkpoint\u shashi\u 2\checkpoint\u shashi\u 2>python manage.py migrate\u schemas——共享
系统检查发现了一些问题:
警告:
checkpoint.multielectresponse.response:(fields.W340)null对ManyToManyField没有影响。
==正在为公共架构运行迁移
系统检查发现了一些问题:
警告:
checkpoint.multielectresponse.response:(fields.W340)null对ManyToManyField没有影响。
要执行的操作:
应用所有迁移:网站、检查点、帐户、django_注释、重定向、核心、管理员、twitter、图库、tastypie、客户、身份验证、站点、博客、通用、内容类型、会话、配置、表单、页面、社交帐户
运行迁移:
正在渲染模型状态。。。完成
正在应用core.0002_auto_20150414_2140…回溯(最近一次调用):
文件“manage.py”,第10行,在
从命令行(sys.argv)执行命令
文件“G:\Py\u Envs\Racknole\checkpoint\u env\lib\site packages\django\core\management\\uuuuuuuuu init\uuuuuuuuu.Py”,第350行,从命令行执行
utility.execute()
文件“G:\Py\u Envs\Racknole\checkpoint\u env\lib\site packages\django\core\management\\uuuuuuuu init\uuuuuuuu.Py”,第342行,在execute中
self.fetch_命令(子命令)。从_argv(self.argv)运行_
文件“G:\Py\u Envs\Racknole\checkpoint\u env\lib\site packages\django\core\management\base.Py”,第348行,运行于\u argv
self.execute(*args,**cmd_选项)
文件“G:\Py\u Envs\Racknole\checkpoint\u env\lib\site packages\django\core\management\base.Py”,第399行,在execute中
输出=self.handle(*args,**选项)
文件“G:\Py\u Envs\Racknole\checkpoint\u env\lib\site packages\tenant\u schemas\management\commands\migrate\u schemas.Py”,第42行,位于句柄中
self.run_迁移(self.schema_名称、设置、共享_应用)
运行迁移中第65行的文件“G:\Py\u Envs\Racknole\checkpoint\u env\lib\site packages\tenant\u schemas\management\commands\migrate\u schemas.Py”
command.execute(*self.args,**self.options)
文件“G:\Py\u Envs\Racknole\checkpoint\u env\lib\site packages\django\core\management\base.Py”,第399行,在execute中
输出=self.handle(*args,**选项)
文件“G:\Py\u Envs\Racknole\checkpoint\u env\lib\site packages\django\core\management\commands\migrate.Py”,第200行,位于句柄中
executor.migrate(目标、计划、假=假、假首字母=假首字母)
文件“G:\Py\u Envs\Racknole\checkpoint\u env\lib\site packages\django\db\migrations\executor.Py”,第92行,在migrate中
self.\u迁移\u所有\u转发(计划、完整计划、假=假、假首字母=假首字母)
文件“G:\Py\u Envs\Racknole\checkpoint\u env\lib\site packages\django\db\migrations\executor.Py”,第121行,在“全部向前迁移”中
state=self.apply\u迁移(state,migration,false=false,false\u initial=false\u initial)
文件“G:\Py\u Envs\Racknole\checkpoint\u env\lib\site packages\django\db\migrations\executor.Py”,第198行,在应用迁移中
state=migration.apply(状态,模式编辑器)
文件“G:\Py\u Envs\Racknole\checkpoint\u env\lib\site packages\django\db\migrations\migration.Py”,第123行,在apply中
操作。数据库转发(self.app\u标签、模式编辑器、旧状态、项目状态)
数据库中的文件“G:\Py\u Envs\Racknole\checkpoint\u env\lib\site packages\django\db\migrations\operations\fields.Py”第201行
schema_editor.alter_字段(从_模型、从_字段到_字段)
文件“G:\Py\u Envs\Racknole\checkpoint\u env\lib\site packages\django\db\backends\base\schema.Py”,第482行,在alter\u字段中
旧参数,新参数,严格)
文件“G:\Py\u Envs\Racknole\checkpoint\u env\lib\site packages\django\db\backends\base\schema.Py”,第491行,在\u alter\u字段中
fk_name=self._constraint_name(模型,[old_field.column],外键=True)
文件“G:\Py\u Envs\Racknole\checkpoint\u env\lib\site packages\django\db\backends\base\schema.Py”,第911行,在\u constraint\u name中
约束=self.connection.introspection.get_约束(游标、模型._meta.db_表)
get\U约束中的文件“G:\Py\u Envs\Racknole\checkpoint\u env\lib\site packages\tenant\u schemas\postgresql\u backend\introspection.Py”,第287行
“表”:表名称,
文件“G:\Py\u Envs\Racknole\checkpoint\u env\lib\site packages\django\db\backends\utils.Py”,执行中第79行
返回super(CursorDebugWrapper,self).execute(sql,params)
文件“G:\Py\u Envs\Racknole\checkpoint\u env\lib\site packages\django\db\backends\utils.Py”,执行中第64行
返回self.cursor.execute(sql,params)
文件“G:\Py\u Envs\Racknole\checkpoint\u env\lib\site packages\django\db\utils.Py”,第95行,在\uu出口处__
6.重新播放(dj_exc_类型、dj_exc_值、回溯)
文件“G:\Py\u Envs\Racknole\checkpoint\u env\lib\site packages\django\db\backends\utils.Py”,执行中第64行
返回self.cursor.execute(sql,params)
django.db.utils.ProgrammingError:列am.amcanorder不存在
第13行:当am.amcanorder

在PostgreSQL中,9.5之前的amcanorder是目录列。在PostgreSQL 9.6中。显然,django租户模式使用它。

你的问题是什么<代码>列am.amcanorder不存在表示名为“amcanorder”的列在名为或别名为“am”的表中不存在。。。我没有定义任何名为amcanorder的列,而不是loong error share query with us。该表来自租户包,我也没有在代码中的任何地方使用该表。克隆的项目在其他计算机上运行时不会出现此错误。满足所有要求。因此,我无法找到此错误的原因。您使用的是哪个版本的PostgreSQL?是的,我在PostgreSQL 9.4中尝试了它,它成功了。谢谢Sergey Gornostaev。