[{"data":1,"prerenderedAt":398},["ShallowReactive",2],{"Categories":3,"NavIndexCategoriesCountFooter":203,"content-\u002F2016\u002F01\u002F11\u002Fupgrading-homebrew-postgres\u002F":204},[4,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,68,70,71,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202],{"category":5},"System Administration",{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":27},"Software Development",{"category":5},{"category":5},{"category":5},{"category":5},{"category":27},{"category":27},{"category":5},{"category":5},{"category":5},{"category":27},{"category":5},{"category":5},{"category":5},{"category":27},{"category":27},{"category":27},{"category":27},{"category":5},{"category":5},{"category":5},{"category":27},{"category":27},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":27},{"category":5},{"category":5},{"category":27},{"category":27},{"category":27},{"category":27},{"category":5},{"category":27},{"category":27},{"category":67},"Drones & RC",{"category":69},"DIY Projects",{"category":67},{"category":72},"Photography",{"category":69},{"category":69},{"category":69},{"category":67},{"category":69},{"category":69},{"category":69},{"category":69},{"category":69},{"category":69},{"category":69},{"category":69},{"category":69},{"category":69},{"category":69},{"category":69},{"category":69},{"category":69},{"category":67},{"category":69},{"category":69},{"category":67},{"category":67},{"category":72},{"category":72},{"category":72},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":5},{"category":5},{"category":72},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":5},{"category":67},{"category":67},{"category":72},{"category":72},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":72},{"category":67},{"category":138},"3D Printing - Laser Cutting - CNC",{"category":138},{"category":138},{"category":138},{"category":138},{"category":138},{"category":138},{"category":138},{"category":138},{"category":138},{"category":138},{"category":138},{"category":5},{"category":138},{"category":27},{"category":27},{"category":138},{"category":138},{"category":72},{"category":158},"Photography,3D Printing - Laser Cutting - CNC",{"category":27},{"category":27},{"category":69},{"category":27},{"category":27},{"category":27},{"category":27},{"category":5},{"category":67},{"category":5},{"category":5},{"category":27},{"category":27},{"category":27},{"category":27},{"category":27},{"category":69},{"category":27},{"category":27},{"category":27},{"category":27},{"category":181},"Home Assistant",{"category":181},{"category":72},{"category":27},{"category":27},{"category":72},{"category":138},{"category":5},{"category":72},{"category":72},{"category":138},{"category":27},{"category":181},{"category":181},{"category":72},{"category":72},{"category":72},{"category":72},{"category":72},{"category":72},{"category":72},{"category":72},191,{"id":205,"title":206,"body":207,"category":383,"date":384,"description":213,"embedImage":383,"extension":385,"image":383,"intro":386,"meta":387,"navigation":388,"path":389,"seo":390,"series":383,"sitemap":391,"stem":392,"tags":393,"__hash__":397},"content\u002F2016\u002F01\u002F11\u002Fupgrading-homebrew-postgres.md","Upgrading homebrew postgres",{"type":208,"value":209,"toc":377},"minimark",[210,214,217,231,236,241,252,256,262,266,272,276,282,286,292,295,299,307,310,314,320,324,330,334,340,343,348,351,356,359,364,368,374],[211,212,213],"p",{},"Homebrew postgresql updated from 9.4.x to 9.5.x today.",[211,215,216],{},"This meant that after update it wouldn't start because the database needed upgrading.",[211,218,219,220,230],{},"I started with ",[221,222,229],"a",{"href":223,"rel":224,"target":228},"https:\u002F\u002Fkkob.us\u002F2014\u002F12\u002F20\u002Fhomebrew-and-postgresql-9-4\u002F",[225,226,227],"nofollow","noopener","noreferer","_blank","this article"," - which in summary would be:",[232,233,235],"h3",{"id":234},"pg_upgrade-method","pg_upgrade method",[237,238,240],"h4",{"id":239},"stop-and-upgrade","Stop and upgrade",[242,243,248],"pre",{"className":244,"code":246,"language":247},[245],"language-text","launchctl unload ~\u002FLibrary\u002FLaunchAgents\u002Fhomebrew.mxcl.postgresql.plist\nbrew update && brew upgrade postgresql\n","text",[249,250,246],"code",{"__ignoreMap":251},"",[237,253,255],{"id":254},"create-empty-db","Create empty db",[242,257,260],{"className":258,"code":259,"language":247},[245],"initdb \u002Fusr\u002Flocal\u002Fvar\u002Fpostgres9.5 -E utf8\n",[249,261,259],{"__ignoreMap":251},[237,263,265],{"id":264},"upgrade-db","Upgrade db",[242,267,270],{"className":268,"code":269,"language":247},[245],"pg_upgrade \\\n  -d \u002Fusr\u002Flocal\u002Fvar\u002Fpostgres \\\n  -D \u002Fusr\u002Flocal\u002Fvar\u002Fpostgres9.5 \\\n  -b \u002Fusr\u002Flocal\u002FCellar\u002Fpostgresql\u002F9.4.5_2\u002Fbin\u002F \\\n  -B \u002Fusr\u002Flocal\u002FCellar\u002Fpostgresql\u002F9.5.0\u002Fbin\u002F \\\n  -v\n",[249,271,269],{"__ignoreMap":251},[237,273,275],{"id":274},"tidy-up","Tidy up",[242,277,280],{"className":278,"code":279,"language":247},[245],"mv \u002Fusr\u002Flocal\u002Fvar\u002Fpostgres \u002Fusr\u002Flocal\u002Fvar\u002Fpostgres9.4\nmv \u002Fusr\u002Flocal\u002Fvar\u002Fpostgres9.5 \u002Fusr\u002Flocal\u002Fvar\u002Fpostgres\n",[249,281,279],{"__ignoreMap":251},[237,283,285],{"id":284},"start-service","Start service",[242,287,290],{"className":288,"code":289,"language":247},[245],"launchctl load ~\u002FLibrary\u002FLaunchAgents\u002Fhomebrew.mxcl.postgresql.plist\n",[249,291,289],{"__ignoreMap":251},[211,293,294],{},"But - my postgres\u002Ftemplate0\u002Ftemplate1 databases had different encodings - template1 was in unicode, template0 and postgres in SQL_ASCII. So pg_upgrade failed. Couldn't find a configuration to initdb that would work.",[232,296,298],{"id":297},"pg_dumpall-method","pg_dumpall method",[211,300,301,302],{},"So - time to look at the manual method on ",[221,303,306],{"href":304,"rel":305,"target":228},"http:\u002F\u002Fwww.postgresql.org\u002Fdocs\u002F9.5\u002Fstatic\u002Fupgrading.html",[225,226,227],"the migration psql doc",[211,308,309],{},"The result was a combination. Note that I'd already performed the installation via homebrew in the previous step - so the rest of the fix was to clear out the 9.5 db directory and start again:",[237,311,313],{"id":312},"stop-if-running-via-launchctl","Stop if running via launchctl",[242,315,318],{"className":316,"code":317,"language":247},[245],"launchctl unload ~\u002FLibrary\u002FLaunchAgents\u002Fhomebrew.mxcl.postgresql.plist\n",[249,319,317],{"__ignoreMap":251},[237,321,323],{"id":322},"make-sure-any-previous-attempt-to-upgrade-is-removed","Make sure any previous attempt to upgrade is removed",[242,325,328],{"className":326,"code":327,"language":247},[245],"rm -rf \u002Fusr\u002Flocal\u002Fvar\u002Fpostgres9.5\n",[249,329,327],{"__ignoreMap":251},[237,331,333],{"id":332},"start-old-install-dump-the-entire-db-and-then-stop-it-again","Start old install, dump the entire db and then stop it again",[242,335,338],{"className":336,"code":337,"language":247},[245],"\u002Fusr\u002Flocal\u002FCellar\u002Fpostgresql\u002F9.4.5_2\u002Fbin\u002Fpg_ctl -D \u002Fusr\u002Flocal\u002Fvar\u002Fpostgres -l \u002Fusr\u002Flocal\u002Fvar\u002Fpostgres\u002Fserver.log start\n\u002Fusr\u002Flocal\u002FCellar\u002Fpostgresql\u002F9.4.5_2\u002Fbin\u002Fpg_dumpall > outputfile\n\u002Fusr\u002Flocal\u002FCellar\u002Fpostgresql\u002F9.4.5_2\u002Fbin\u002Fpg_ctl -D \u002Fusr\u002Flocal\u002Fvar\u002Fpostgres -l \u002Fusr\u002Flocal\u002Fvar\u002Fpostgres\u002Fserver.log stop\n",[249,339,337],{"__ignoreMap":251},[237,341,255],{"id":342},"create-empty-db-1",[242,344,346],{"className":345,"code":259,"language":247},[245],[249,347,259],{"__ignoreMap":251},[237,349,275],{"id":350},"tidy-up-1",[242,352,354],{"className":353,"code":279,"language":247},[245],[249,355,279],{"__ignoreMap":251},[237,357,285],{"id":358},"start-service-1",[242,360,362],{"className":361,"code":289,"language":247},[245],[249,363,289],{"__ignoreMap":251},[237,365,367],{"id":366},"import","Import",[242,369,372],{"className":370,"code":371,"language":247},[245],"psql -d postgres -f outputfile\n",[249,373,371],{"__ignoreMap":251},[211,375,376],{},"This worked - and now my databases are UTF based across all of them so the pg_upgrade method should work next time.",{"title":251,"searchDepth":378,"depth":378,"links":379},2,[380,382],{"id":234,"depth":381,"text":235},3,{"id":297,"depth":381,"text":298},null,"2016-01-11 09:19 +0100","md","How to deal with upgrading a database after upgrading the engine",{},true,"\u002F2016\u002F01\u002F11\u002Fupgrading-homebrew-postgres",{"title":206,"description":213},{"loc":389},"2016\u002F01\u002F11\u002Fupgrading-homebrew-postgres",[394,395,396],"postgresql","pg-upgrade","homebrew","m-tPaMqxSN3ZhwQdJjljF3WSKJuSS8m2n3fUO_pM56U",1775293011948]