country-list icon indicating copy to clipboard operation
country-list copied to clipboard

Wrong string escape format for PostgrrSQL

Open tuscland opened this issue 10 years ago • 3 comments

Hello,

I am using the country.postgresql.sql file located at https://raw.githubusercontent.com/umpirsky/country-list/master/country/cldr/en/country.postgresql.sql.

Doing psql -f country.postgresql.sql does not work because of the way "People's Democratic Republic of Yemen" is escaped. The escape sequence should be doubling the single-quote character ''.

I wonder if this is expected, just thought I'd let you know.

Thanks! Cam

tuscland avatar Jan 07 '15 19:01 tuscland

@tuscland Oh, this is a bug in deed. Thanks for reposting! :+1:

umpirsky avatar Jan 08 '15 08:01 umpirsky

Also, Postgresql should not use VARCHAR(64), but text. This is the convention in PG. VARCHAR is imposing a restriction that isn't needed.

EvanCarroll avatar May 22 '16 03:05 EvanCarroll

If I could advise one more thing... In postgresql this is much better done as with a schema..

CREATE SCHEMA country_code;
CREATE TABLE country_code.en_US (country_code, country_name)...

Actually, the whole thing is much better done in one table... umprisky.country_codes(locale, abbreviation, expanded_name).. and so on, I'd rather one file, and get everything in a sane prebuilt setup

EvanCarroll avatar May 22 '16 03:05 EvanCarroll