heroku / legacy-cli

Heroku CLI
https://cli.heroku.com
MIT License
1.37k stars 380 forks source link

ensure_remote_db_empty returns incorrect result if LANG is not "en_US.UTF-8" #1935

Closed keiko713 closed 8 years ago

keiko713 commented 8 years ago

https://github.com/heroku/heroku/blob/master/lib/heroku/helpers/pg_dump_restore.rb#L60

~ $ LANG=ja_JP.UTF-8 psql $HEROKU_POSTGRESQL_YELLOW_URL -c 'select count(*) = 0 from pg_stat_user_tables;'
 ?column? 
----------
 t
(1 行)

~ $ psql $HEROKU_POSTGRESQL_YELLOW_URL -c 'select count(*) = 0 from pg_stat_user_tables;'
 ?column? 
----------
 t
(1 row)

If the client's laptop has a different LANG setting than en_US.UTF-8, even though the database is empty, it raises the error "Remote database is not empty". We should probably change it to some regex.