{"id":627,"date":"2007-12-19T22:49:58","date_gmt":"2007-12-19T22:49:58","guid":{"rendered":"http:\/\/www.bartbusschots.ie\/blog\/?p=627"},"modified":"2014-08-04T16:54:58","modified_gmt":"2014-08-04T16:54:58","slug":"beating-postgersql-8-into-submission-on-os-x-105-leopard","status":"publish","type":"post","link":"https:\/\/www.bartbusschots.ie\/s\/2007\/12\/19\/beating-postgersql-8-into-submission-on-os-x-105-leopard\/","title":{"rendered":"Beating PostgerSQL 8 Into Submission on OS X 10.5 Leopard"},"content":{"rendered":"<p>In general the move to Leopard has been very smooth for me but there was one notable exception, getting a working PostgreSQL 8 sever up and running on my MacBookPro. A few weeks ago I&#8217;d expended a lot of time and effort on this and gotten nowhere so at that stage I&#8217;d decided to work around the problem by using a remote PostgreSQL server rather than running one locally. This works fine as long as you have broadband internet access. However, I&#8217;m off to Belgium for a week on Saturday where I&#8217;ll have no broadband but where I will need to get some development work done that requires access to a PostgerSQL server.<\/p>\n<p>With the end of the week getting closer I had another go at getting PosgreSQL to behave on OS X and I did eventually succeed. I got 90% of the way there by following <a href=\"http:\/\/www2.russbrooks.com:8080\/2007\/11\/4\/install-postgresql-on-mac-os-x-10-5-leopard\" target=\"_blank\">these instructions<\/a> but then I ran into a few strange problem that took a little more time and effort to work around. However, the good news is that I got it all figured out in the end!<\/p>\n<p>[tags]PostgreSQL, OS X, OS X 10.5 Leopard[\/tags]<\/p>\n<p><!--more-->Firstly, PostgreSQL&#8217;s security model requires that some commands be issued as the user the server runs under. This is a good idea and generally not a problem. In Leopard I used to get a shell as the postgres user by issuing the following terminal command:<\/p>\n<p><code>sudo su - postgres<\/code><\/p>\n<p>However, this doesn&#8217;t work for me when I install PosgreSQL using the instructions linked above. When I issue the above command I don&#8217;t get an error but I get dropped back into my own account rather than the postgres account. No idea why. It&#8217;s just odd. I found my way round that quick enough by using the following instead:<\/p>\n<p><code>sudo -u postgres bash<\/code><\/p>\n<p>That gives me a shell as the user postgres. However, within that shell odd things were happening. For example, when ever I tried to create a user or a database I got the following bizarre result:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nbash-3.2$ createuser bart\nShall the new role be a superuser? (y\/n) y\ncreateuser: could not connect to database postgres: FATAL:  role &quot;252F6238093003CC96A19B829010327D1B3019B8&quot; does not exist\nbash-3.2$\n<\/pre>\n<p>For some reason that I can&#8217;t figure out PostgreSQL seems to be reading the username of the currently logged in person as 252F6238093003CC96A19B829010327D1B3019B8. Madness. However, I did find an easy workaround, always explicitly tell PostgeSQL which user you are using the <code>--username<\/code> flag like so:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nbash-3.2$ createdb --username postgres vtie_portal_live\nCREATE DATABASE\nbash-3.2$\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>In general the move to Leopard has been very smooth for me but there was one notable exception, getting a working PostgreSQL 8 sever up and running on my MacBookPro. A few weeks ago I&#8217;d expended a lot of time and effort on this and gotten nowhere so at that stage I&#8217;d decided to work [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[12],"tags":[3,26,424],"series":[],"class_list":["post-627","post","type-post","status-publish","format-standard","hentry","category-computers-tech","tag-databases","tag-os-x","tag-postgresql"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p7t9xK-a7","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.bartbusschots.ie\/s\/wp-json\/wp\/v2\/posts\/627","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bartbusschots.ie\/s\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bartbusschots.ie\/s\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bartbusschots.ie\/s\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bartbusschots.ie\/s\/wp-json\/wp\/v2\/comments?post=627"}],"version-history":[{"count":1,"href":"https:\/\/www.bartbusschots.ie\/s\/wp-json\/wp\/v2\/posts\/627\/revisions"}],"predecessor-version":[{"id":7407,"href":"https:\/\/www.bartbusschots.ie\/s\/wp-json\/wp\/v2\/posts\/627\/revisions\/7407"}],"wp:attachment":[{"href":"https:\/\/www.bartbusschots.ie\/s\/wp-json\/wp\/v2\/media?parent=627"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bartbusschots.ie\/s\/wp-json\/wp\/v2\/categories?post=627"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bartbusschots.ie\/s\/wp-json\/wp\/v2\/tags?post=627"},{"taxonomy":"series","embeddable":true,"href":"https:\/\/www.bartbusschots.ie\/s\/wp-json\/wp\/v2\/series?post=627"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}