-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Import Error world.sql #761
Comments
🤖 The error message you're encountering suggests that the To resolve this issue, you need to ensure that the
Here is an example of how you might create the CREATE TABLE public.subregions (
id SERIAL PRIMARY KEY,
name VARCHAR(255),
postal_code INT,
state_code VARCHAR(10),
country_code VARCHAR(10),
latitude NUMERIC(10, 8),
longitude NUMERIC(11, 8),
created_at TIMESTAMP WITH TIME ZONE,
updated_at TIMESTAMP WITH TIME ZONE,
is_active BOOLEAN,
wikidata_id VARCHAR(255)
); Please adjust the data types and column names as necessary to match your full dataset requirements. After creating the table with the above SQL command (or a modified version that suits your data), you should be able to import your However, it's important to note that the structure of the CREATE TABLE `subregions` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`country_id` int(11) NOT NULL,
`code` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`region_id` int(11) NOT NULL,
`iso2` varchar(2) COLLATE utf8mb4_unicode_ci NOT NULL,
`latitude` decimal(10,8) NOT NULL,
`longitude` decimal(11,8) NOT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`flag` tinyint(1) NOT NULL DEFAULT '1',
`wikiDataId` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; You can find this structure in the sql/world.sql file. Please ensure that the table structure you create matches this structure to avoid any import errors. Sources
|
@dosu-bot The answer is not helpful. The problem is that psql/world.sql was dumped using pg_dump as a text dump, and it can be restored using psql only, not with pg_restore. In the current psql/world.sql all tables/constraints/etc. are handled in alphabetic order (furthermore, the script tries to delete them without even checking if they exist, for example), and all tables are populated in alphabetic order (cities first) too. But those tables have foreign key constraints, so it won't work. A possible solution would be to produce a psql/world.dump file using pg_dump instead of a textual dump so that it could be used with pg_restore. But then database version compatibility might become a problem... |
Trying to import the world.sql file into my PSQL DB and I get this:
The text was updated successfully, but these errors were encountered: