sqlpostgresqlimportphppgadmin

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. My process is like this:

  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...

Line 73 in its entirety is:

 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. 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.

Any idea what could be going on?

Thanks much.


Solution

  • 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.

    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.

    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 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.

    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.

    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.

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