简体   繁体   English

尝试从两个PostgreSQL数据库导入数据库时​​出现语法错误

[英]Syntax error when trying to import database from two PostgreSQL databases

I'm trying to export a database from one server and put it on another using phpPgAdmin. 我正在尝试从一台服务器导出数据库,然后使用phpPgAdmin将其放在另一台服务器上。 My process is like this: 我的过程是这样的:

  1. select the database in server 1 and hit the export button 选择服务器1中的数据库,然后单击导出按钮
  2. select "data and structure and select the option in the dropdown "copy" 选择“数据和结构,然后在下拉菜单中选择”复制”
  3. download 下载
  4. create the a database of the same name in server 2 with the same name as the database from server 1 在服务器2中创建一个与服务器1中的数据库同名的数据库
  5. select that database, open up the SQL pane, and paste the SQL code I downloaded from server 1 选择该数据库,打开“ SQL”窗格,然后粘贴我从服务器1下载的SQL代码
  6. Execute 执行

That's when I get the error: 那就是我得到错误的时候:

ERROR:  syntax error at or near "OWNED"
LINE 73: ALTER SEQUENCE address_customer_id_seq OWNED BY address.cust...

Line 73 in its entirety is: 第73行的全部内容是:

 ALTER SEQUENCE address_customer_id_seq OWNED BY address.customer_id;

I've read here that it may be because I've have slightly different versions of postgre on my two servers. 我在这里读到这可能是因为我的两个服务器上的postgre版本略有不同。 So I checked with the server tech, who said that, yes, there was that issue. 因此,我与服务器技术人员核对了一下,后者说,是的,存在这个问题。 So he upgraded server 2. I'm getting the same error however. 所以他升级了服务器2。但是,我得到了同样的错误。

Any idea what could be going on? 知道会发生什么吗?

Thanks much. 非常感谢。

PostgreSQL 8.4 will not produce a dump that restores to 8.1, as it'll use features and syntax that do not exist in 8.1. PostgreSQL 8.4不会产生恢复到8.1的转储,因为它将使用8.1中不存在的功能和语法。

You might be able to downgrade by running 8.1's pg_dump against the 8.4 database, but it's most likely that the dump will simply fail. 可以通过对8.4数据库运行8.1的pg_dump来降级,但是转储很可能会失败。

Downgrading that far will be a challenge and may involve hand-editing the dump produced by 8.4's pg_dump to make it 8.1-compatible. 降级到这个程度将是一个挑战,可能需要手动编辑8.4的pg_dump产生的转储以使其与8.1兼容。

8.1 is ancient and unsupported; 8.1是古老且不受支持的; its final end-of-life release was in November 2010. You shouldn't even consider using it for any new project or tool, and really need to be planning an upgrade. 它的最终生命周期发布于2010年11月。您甚至不应该考虑将其用于任何新项目或工具,并且确实需要计划进行升级。

See the PostgreSQL version policy for just how different these versions are. 有关这些版本的不同之处,请参见PostgreSQL版本策略 You can learn more by reading the release notes for versions 8.2.0, 8.3.0 and 8.4.0. 您可以通过阅读版本8.2.0、8.3.0和8.4.0的发行说明来了解更多信息。 It is important to understand that application visible behavior changes are present in each release; 了解每个发行版中存在应用程序可见的行为更改非常重要; you must test your applications and may need to enable some backward compatibility settings. 您必须测试您的应用程序,并且可能需要启用一些向后兼容设置。

You should also read the upgrading a PostgreSQL cluster documentation—but be aware that pg_upgrade can not be used to upgrade a version older than 8.4. 您还应该阅读升级PostgreSQL集群文档的信息,但是要知道pg_upgrade 不能用于升级8.4之前的版本。

This would all be much less painful if your install weren't seven years out of date. 如果您的安装没有过时7年,那么这一切都会减轻很多。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM