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.

6
  • 2
    category :: it appears the .sql dump uses the silly mysql backticks to quote table and column names. Commented Apr 25, 2018 at 9:45
  • 1
    See here - wiki.postgresql.org/wiki/… - "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. Commented Apr 25, 2018 at 9:50
  • @wildplasser Thanks a log, i'll give it a shot. Commented Apr 25, 2018 at 10:25
  • 1
    @JosMac You too, thanks a lot Commented Apr 25, 2018 at 10:26
  • I changed to mysql and it really works, thanks a lot ~ Commented Apr 25, 2018 at 12:36

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.