【问题标题】:Adding ForeignKeys to a table将外键添加到表中
【发布时间】:2020-02-27 15:52:55
【问题描述】:

我在一个学校项目中使用 PostgreSQL,我正在尝试向我的数据库表中添加不同的外键,但是当我运行时:

ALTER TABLE PARTSUPP ADD FOREIGN KEY (PS_SUPPKEY) REFERENCES SUPPLIER(S_SUPPKEY);

在 SQL shell 上,我收到以下错误消息:

server closed the connection unexpectedly
    This probably means the server terminated abnormally
    before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.

希望你能帮我解决这个问题!

【问题讨论】:

  • 您的确切 Postgres 版本是什么? select version();会告诉你
  • PostgreSQL 12.1

标签: sql postgresql ddl


【解决方案1】:

当您运行语句时,您的 PostgreSQL 服务器正在崩溃。 Postgres 日志中可能提供更多信息。

【讨论】:

猜你喜欢
  • 1970-01-01
  • 2012-04-19
  • 2020-06-09
  • 2013-07-10
  • 2014-02-20
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多