0

I already followed these two answers to restore wiki sql into postgres.

  1. how-to-build-wikipedia-category-hierarchy
  2. import-sql-dump-into-postgresql-database

But I got this error messages:

psql:enwiki-latest-category.sql:125: invalid command \'s_soccer_players',1,0,0),
(247303133,'Young_Harris_Mountain_Lions_men' 
psql:enwiki-latest-category.sql:137: ERROR:  syntax error at or near "`" LINE 1: INSERT INTO `category` VALUES (2,'Unprintworthy_redirects',1...

I used to thought that the error occurs because Chinese encoding, but it turns out that English doesn't work out as well. I'm a postgre noobie, any comment would be appreciated.

Krzysztof Janiszewski
  • 3,763
  • 3
  • 18
  • 38
張泰瑋
  • 138
  • 2
  • 9
  • 2
    `category` :: it appears the .sql dump uses the silly mysql **backticks** to quote table and column names. – wildplasser Apr 25 '18 at 09:45
  • 1
    See here - https://wiki.postgresql.org/wiki/Things_to_find_out_about_when_moving_from_MySQL_to_PostgreSQL - "MySQL uses ` (accent mark or backtick) to quote system identifiers, which is decidedly non-standard." So you would have to remove backticks (or replace them with double quotes) from the file before loading it into database. – JosMac Apr 25 '18 at 09:50
  • @wildplasser Thanks a log, i'll give it a shot. – 張泰瑋 Apr 25 '18 at 10:25
  • 1
    @JosMac You too, thanks a lot – 張泰瑋 Apr 25 '18 at 10:26
  • I changed to mysql and it really works, thanks a lot ~ – 張泰瑋 Apr 25 '18 at 12:36
  • JosMac wildplasser Is there any tools which can convert wiki dump.sql into postgres's sql format ? I found it every hard to integrate django with mysql in docker-compose ... – 張泰瑋 Apr 26 '18 at 08:45

0 Answers0