尝试从两个PostgreSQL数据库导入数据库时​​出现语法错误 [英] Syntax error when trying to import database from two PostgreSQL databases

查看:176
本文介绍了尝试从两个PostgreSQL数据库导入数据库时​​出现语法错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从一台服务器导出数据库,然后使用phpPgAdmin将其放在另一台服务器上。我的过程是这样的:

I'm trying to export a database from one server and put it on another using phpPgAdmin. My process is like this:


  1. 选择服务器1中的数据库,然后单击导出按钮

  2. 选择数据和结构,然后在下拉列表中选择复制。

  3. download

  4. 在服务器2中创建一个具有相同名称的数据库,与服务器1中的数据库同名

  5. 选择该数据库,打开SQL窗格,然后粘贴我从服务器1中下载的SQL代码

  6. 执行

  1. select the database in server 1 and hit the export button
  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
  5. select that database, open up the SQL pane, and paste the SQL code I downloaded from server 1
  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...

第73行的整体内容是:

Line 73 in its entirety is:

 ALTER SEQUENCE address_customer_id_seq OWNED BY address.customer_id;

我已阅读此处这可能是因为我的两台服务器上的postgre版本略有不同。因此,我与服务器技术人员核对了一下,后者说,是的,存在这个问题。因此,他升级了服务器2。但是,我遇到了同样的错误。

I've read here that it may be because I've have slightly different versions of postgre on my two servers. 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.

有什么想法吗?

非常感谢。

推荐答案

PostgreSQL 8.4不会产生恢复到8.1的转储,因为它将使用8.1中不存在的功能和语法。

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.

可能可以通过在8.4数据库上运行8.1的 pg_dump 来降级,但是很可能

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的 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.1很古老,不受支持;它的最终生命周期发布于2010年11月。您甚至不应该考虑将其用于任何新项目或工具,并且确实需要计划进行升级。

8.1 is ancient and unsupported; 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.

有关这些版本的不同之处,请参见 PostgreSQL版本政策。您可以阅读有关版本8.2.0的发行说明来了解更多信息。 ,8.3.0和8.4.0。了解每个发行版中存在应用可见行为更改是很重要的;您必须测试您的应用程序,并且可能需要启用一些向后兼容性设置。

See the PostgreSQL version policy for just how different these versions are. You can learn more by reading the release notes for versions 8.2.0, 8.3.0 and 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.

您还应该阅读升级PostgreSQL群集文档-但请注意 pg_upgrade 不能用于升级8.4之前的版本。

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.

如果您的安装未过时7年,这一切都会减轻很多痛苦。

This would all be much less painful if your install weren’t seven years out of date.

这篇关于尝试从两个PostgreSQL数据库导入数据库时​​出现语法错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆