I exported SQL file with data from existing Mysql database. Now I am trying to import it in PostgrSQL database.
I tried to use phpPgAdmin import field. I executed this SQL because I have already created my tables.
INSERT INTO `categories` (`id`, `name`, `created_at`, `updated_at`, `ancestry`, `ancestry_depth`, `priority`) VALUES
(1, 'Treileri', '2014-09-24 17:45:02', '2014-09-24 17:45:02', NULL, 0, NULL),
(2, 'Kravas automašīnas', '2014-09-24 17:45:02', '2014-09-24 17:45:02', NULL, 0, NULL),
(3, 'Teleskopiskie iekrāvēji', '2014-09-24 17:45:02', '2014-09-24 17:45:02', NULL, 0, NULL),
(4, 'Ekskavatori', '2014-09-24 17:45:02', '2014-09-24 17:45:02', NULL, 0, NULL),
(5, 'Iekrāvēji', '2014-09-24 17:45:02', '2014-09-24 17:45:02', NULL, 0, NULL),
(6, 'Pacēlāji', '2014-09-24 17:45:02', '2014-09-24 17:45:02', NULL, 0, NULL),
(7, 'Elektroiekārtas', '2014-09-24 17:45:02', '2014-09-24 17:45:02', NULL, 0, NULL),
(8, 'Ģeneratori', '2014-09-24 17:45:02', '2014-09-24 17:45:02', '7', 1, NULL),
(9, 'Strāvas kārbas', '2014-09-24 17:45:02', '2014-09-24 17:45:02', '7', 1, NULL),
(10, 'Aprīkojums', '2014-09-24 17:45:02', '2014-09-24 17:45:02', NULL, 0, NULL),
(11, 'Vibro blietes', '2014-09-24 17:45:03', '2014-09-24 17:45:03', '10', 1, NULL),
(12, 'Ūdens pumpji', '2014-09-24 17:45:03', '2014-09-24 17:45:03', '10', 1, NULL),
(13, 'Vinčas', '2014-09-24 17:45:03', '2014-09-24 17:45:03', '10', 1, NULL),
(14, 'Gāzes sildītāji', '2014-09-24 17:45:03', '2014-09-24 17:45:03', '10', 1, NULL),
(15, 'Plātņu satvērēji', '2014-09-24 17:45:03', '2014-09-24 17:45:03', '10', 1, NULL),
(16, 'Celtniecības sastatnes', '2014-09-24 17:45:03', '2014-09-24 17:45:03', NULL, 0, NULL),
(17, 'Citi', '2014-09-24 17:45:03', '2014-09-24 17:45:03', NULL, 0, NULL);
Error:
SQL error:
ERROR: syntax error at or near "INTO"
LINE 1: SELECT COUNT(*) AS total FROM (INSERT INTO `categories` (`id...
^
I checked SQL validity here and there was no errors found. I don't understand where is the issue ?
Maybe PostgreSQL version problems?
Based on your suggestions I changed my code to :
INSERT INTO "categories" ("id", "name", "created_at", "updated_at", "ancestry", "ancestry_depth", "priority") VALUES
(1, "Treileri", '2014-09-24 17:45:02', '2014-09-24 17:45:02', NULL, 0, NULL),
(2, "Kravas automašīnas", '2014-09-24 17:45:02', '2014-09-24 17:45:02', NULL, 0, NULL),
(3, "Teleskopiskie iekrāvēji", '2014-09-24 17:45:02', '2014-09-24 17:45:02', NULL, 0, NULL),
(4, "Ekskavatori", '2014-09-24 17:45:02', '2014-09-24 17:45:02', NULL, 0, NULL),
(5, "Iekrāvēji", '2014-09-24 17:45:02', '2014-09-24 17:45:02', NULL, 0, NULL),
(6, "Pacēlāji", '2014-09-24 17:45:02', '2014-09-24 17:45:02', NULL, 0, NULL),
(7, "Elektroiekārtas", '2014-09-24 17:45:02', '2014-09-24 17:45:02', NULL, 0, NULL),
(8, "Ģeneratori", '2014-09-24 17:45:02', '2014-09-24 17:45:02', '7', 1, NULL),
(9, "Strāvas kārbas", '2014-09-24 17:45:02', '2014-09-24 17:45:02', '7', 1, NULL),
(10, "Aprīkojums", '2014-09-24 17:45:02', '2014-09-24 17:45:02', NULL, 0, NULL),
(11, "Vibro blietes", '2014-09-24 17:45:03', '2014-09-24 17:45:03', '10', 1, NULL),
(12, "Ūdens pumpji", '2014-09-24 17:45:03', '2014-09-24 17:45:03', '10', 1, NULL),
(13, "Vinčas", '2014-09-24 17:45:03', '2014-09-24 17:45:03', '10', 1, NULL),
(14, "Gāzes sildītāji", '2014-09-24 17:45:03', '2014-09-24 17:45:03', '10', 1, NULL),
(15, "Plātņu satvērēji", '2014-09-24 17:45:03', '2014-09-24 17:45:03', '10', 1, NULL),
(16, "Celtniecības sastatnes", '2014-09-24 17:45:03', '2014-09-24 17:45:03', NULL, 0, NULL),
(17, "Citi", '2014-09-24 17:45:03', '2014-09-24 17:45:03', NULL, 0, NULL);
Still the same error.
Thanks.