From 31d43dc58ec686b35b21876ea80a2ad6ff9e9ae3 Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Fri, 5 Jan 2018 23:57:54 +0000 Subject: [PATCH] lib/postgres/continent.sql --- lib/postgres/continent.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/postgres/continent.sql b/lib/postgres/continent.sql index f00a541f..2247e2d1 100644 --- a/lib/postgres/continent.sql +++ b/lib/postgres/continent.sql @@ -1,8 +1,8 @@ DROP TABLE IF EXISTS continent; CREATE TABLE IF NOT EXISTS continent ( - id char(3) PRIMARY KEY, + id bigint PRIMARY KEY, + id char(3) UNIQUE, name varchar(200), - geoid bigint ); GRANT ALL ON TABLE continent TO www; GRANT ALL ON TABLE continent TO nico; @@ -16,5 +16,5 @@ DELETE FROM continent; -- NB 05.01.18 INSERT INTO continent VALUES ('OC','Oceania'); -- NB 05.01.18 INSERT INTO continent VALUES ('SA','South America'); -- NB 05.01.18 INSERT INTO continent VALUES ('AN','Antarctica'); -COPY continent FROM PROGRAM 'curl -s http://download.geonames.org/export/dump/readme.txt | awk "/^Continent codes/ {ok=1} ok==1 && /^$/{exit} ok==1 {print \$0}" | tail -n +2 | sed -e "s/ : /\t/" -e "s/[\t ]\+geonameId=/\t/"' WITH (format 'text', NULL ''); +COPY continent FROM PROGRAM 'curl -s http://download.geonames.org/export/dump/readme.txt | awk "/^Continent codes/ {ok=1} ok==1 && /^$/{exit} ok==1 {print \$0}" | tail -n +2 | sed -e "s/ : /\t/" -e "s/[\t ]\+geonameId=/\t/" | cut -f 3,1,2' WITH (format 'text', NULL ''); COMMIT; -- 2.47.3