Python django中不同模式的表与postgresql的关系

Python django中不同模式的表与postgresql的关系,python,django,postgresql,python-2.7,schema,Python,Django,Postgresql,Python 2.7,Schema,我正在使用Django 1.9和Postgresql,我遇到了不同模式中表之间关系的问题 我面临的问题是,我有一个名为product的表,它位于名为dataflex的模式中,另一个名为client\u product\u sale\u stx的表位于另一个模式中 当我尝试迁移client\u product\u sale\u stx和product之间的关系时,出现以下错误: Applying armazem.0077_clientproductsalestx_setor_id...Traceb

我正在使用Django 1.9和Postgresql,我遇到了不同模式中表之间关系的问题

我面临的问题是,我有一个名为
product
的表,它位于名为
dataflex
的模式中,另一个名为
client\u product\u sale\u stx
的表位于另一个模式中

当我尝试迁移
client\u product\u sale\u stx
product
之间的关系时,出现以下错误:

Applying armazem.0077_clientproductsalestx_setor_id...Traceback (most recent call last):
  File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 350, in execute_from_command_line
utility.execute()
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 342, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 348, in run_from_argv
self.execute(*args, **cmd_options)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 399, in execute
output = self.handle(*args, **options)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/migrate.py", line 200, in handle
executor.migrate(targets, plan, fake=fake, fake_initial=fake_initial)
  File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/executor.py", line 92, in migrate
self._migrate_all_forwards(plan, full_plan, fake=fake, fake_initial=fake_initial)
  File "/usr/local/lib/python2.7/dist-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 "/usr/local/lib/python2.7/dist-packages/django/db/migrations/executor.py", line 198, in apply_migration
state = migration.apply(state, schema_editor)
  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/base/schema.py", line 90, in __exit__
self.execute(sql)
  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/base/schema.py", line 110, in execute
cursor.execute(sql, params)
  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/utils.py", line 79, in execute
return super(CursorDebugWrapper, self).execute(sql, params)
  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
  File "/usr/local/lib/python2.7/dist-packages/django/db/utils.py", line 95, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: ERRO:  syntax error at or near "dataflex"
LINE 1: ...CONSTRAINT "client_product_setor_id_52aad07a_fk_"dataflex"....
应用armazem.0077\u客户端产品SalesTx\u设置器\u id…回溯(最近一次呼叫最后一次):
文件“manage.py”,第10行,在
从命令行(sys.argv)执行命令
文件“/usr/local/lib/python2.7/dist-packages/django/core/management/__-init__.py”,第350行,从命令行执行
utility.execute()
文件“/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py”,第342行,在execute中
self.fetch_命令(子命令)。从_argv(self.argv)运行_
文件“/usr/local/lib/python2.7/dist-packages/django/core/management/base.py”,第348行,在运行时从
self.execute(*args,**cmd_选项)
文件“/usr/local/lib/python2.7/dist packages/django/core/management/base.py”,第399行,在execute中
输出=self.handle(*args,**选项)
handle中的文件“/usr/local/lib/python2.7/dist packages/django/core/management/commands/migrate.py”,第200行
executor.migrate(目标、计划、假=假、假首字母=假首字母)
文件“/usr/local/lib/python2.7/dist packages/django/db/migrations/executor.py”,第92行,在migrate中
self.\u迁移\u所有\u转发(计划、完整计划、假=假、假首字母=假首字母)
文件“/usr/local/lib/python2.7/dist packages/django/db/migrations/executor.py”,第121行,全部向前迁移
state=self.apply\u迁移(state,migration,false=false,false\u initial=false\u initial)
文件“/usr/local/lib/python2.7/dist packages/django/db/migrations/executor.py”,第198行,在apply_migration中
state=migration.apply(状态,模式编辑器)
文件“/usr/local/lib/python2.7/dist packages/django/db/backends/base/schema.py”,第90行,在__
self.execute(sql)
文件“/usr/local/lib/python2.7/dist packages/django/db/backends/base/schema.py”,第110行,在execute中
cursor.execute(sql,params)
文件“/usr/local/lib/python2.7/dist packages/django/db/backends/utils.py”,执行中的第79行
返回super(CursorDebugWrapper,self).execute(sql,params)
文件“/usr/local/lib/python2.7/dist packages/django/db/backends/utils.py”,执行中的第64行
返回self.cursor.execute(sql,params)
文件“/usr/local/lib/python2.7/dist packages/django/db/utils.py”,第95行,在__
6.重新播放(dj_exc_类型、dj_exc_值、回溯)
文件“/usr/local/lib/python2.7/dist packages/django/db/backends/utils.py”,执行中的第64行
返回self.cursor.execute(sql,params)
django.db.utils.ProgrammingError:ERRO:dataflex或其附近出现语法错误
第1行:…约束“客户、产品、设置者、id、52aad07a、fk”dataflex。。。。
在花了一段时间试图找出解决这个问题的方法之后,我尝试将模式的名称改为just
df
,而不是
dataflex
,并且效果很好

我还尝试减少表的名称,它的工作原理与我减少模式名称大小时的工作原理相同,所以这很可能是大型约束名称的问题

djando和postgresql大名在不同模式之间的关系上也存在同样的问题吗

有没有其他方法可以解决这个问题?因为我可能需要有更大名称的表,而且我不能再减少模式的名称大小了

setor\u id
client\u product\u sale\u stx
model/table中关系字段的名称。
产品
模型/表没有关系字段