rake tasks aborting with weird postgres issue

0 views
Skip to first unread message

nicyou...@gmail.com

unread,
Jun 23, 2008, 6:12:43 AM6/23/08
to Cape Town Ruby Brigade
Hey guys, if anyone could help me here I'd really appreciate it.

I've recently switched to Rails 2.1, and having a hard time with rake
tasks and postgres. When I try run anything that involves
db:test:purge it tell me that the "postgres" database doesn't exist.
I'm not trying to connect to the "postgres" database tho. I first hit
this problem when trying db:test:clone, but the same thing happens
with rspec rake tasks, if I run the tasks with --trace they all seem
to cry at db:test:purge. Now from postgres' perspective, trying to
connect to "postgres" would happen if I'm trying to connect as the
postgres user without specifying a db, but I'm not 100% sure that's
the problem, and dont know where it's getting confused even if it is.
My database.yml file is right, and it's set up to connect as the db
user that owns the dev and test databases in question. I've even
tried setting that user as a postgres superuser, but still no luck.

Here's a trace (full stack trace not included, I can supply it if
needed tho):

rake db:test:clone --trace
(in /home/nic/work/smmt)
** Invoke db:test:clone (first_time)
** Invoke db:schema:dump (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:schema:dump
** Invoke db:test:purge (first_time)
** Invoke environment
** Execute db:test:purge
rake aborted!
FATAL: database "postgres" does not exist

Anybody got any advice?? This is killing me.

Cheers.
Nic

James Silberbauer

unread,
Jun 23, 2008, 6:39:45 AM6/23/08
to cape-town-r...@googlegroups.com
Are you able to connect by running script/console?
Rails 2.1 no longer installs the postgres adaptor - it has to be
installed via gem.
- could this be your problem?

James

Nic Young

unread,
Jun 23, 2008, 6:59:54 AM6/23/08
to cape-town-r...@googlegroups.com
I can connect with script/console yeah.

I've managed to get some stuff done by exporting RAILS_ENV to test and
running rake db:migrate ...can also run my rspec user stories fine
and can run individual specs with the ruby interpreter... just not via
rake, which is a serious hinderence.

I do have the postgres gem installed, though I didn't know that 2.1 no
longer installed the postgres adapter. I can see the db from my app,
it's only with rake that I'm having problems.

...still lost.

James Silberbauer

unread,
Jun 23, 2008, 7:20:36 AM6/23/08
to cape-town-r...@googlegroups.com
I don't use postgres myself, so I'm just taking a shot in the dark here.

This thread may be related to your problem in some way:
http://www.ruby-forum.com/topic/155617
It seems the drop & create statements have changed in a way that
postgres 8.1 & earlier don't like.

The only other thing I can think of is to check your database.yml for
odd characters.
You shouldn't have tabs, only spaces. Maybe check the "database:" part
of test?
- Try to run script/console -e test and see if you get an error.

Nic Young

unread,
Jun 23, 2008, 8:07:12 AM6/23/08
to cape-town-r...@googlegroups.com
Hey James,

Thanks for the direction... Ie monkey patched those methods, but to no
avail... dont think that was the problem, though it did seem
promising.

The first thing I checked was my database.yml, I know how sensitive
yml can be ...and it's def right. I also did run script/console test
(you dont need the -e like in script/server) when I checked it the
first time, so the environment is def loading up fine otherwise. (I
created records from console and they do appear in the test db). It
really looks like an issue in rake somewhere... but... ?

...sigh.


On Mon, Jun 23, 2008 at 1:20 PM, James Silberbauer

Nic Young

unread,
Jun 23, 2008, 8:44:46 AM6/23/08
to cape-town-r...@googlegroups.com
So if anyone's interested... don't run Rails 2.1 and postgres
(8.0.15)... just say no.

Rails 2.0.2 works fine.

Sheldon Hearn

unread,
Jun 25, 2008, 8:35:41 AM6/25/08
to cape-town-r...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Monday 23 June 2008 14:44:46 Nic Young wrote:
> So if anyone's interested... don't run Rails 2.1 and postgres
> (8.0.15)... just say no.
>
> Rails 2.0.2 works fine.

My advice is, don't use recent Rails releases that introduced lots of
new features, unless you wish to assist with beta testing.

The Rails core team members are many things -- great release engineers
is not yet an item on the list. :-)

Ciao,
Sheldon.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iD8DBQFIYjudpGJX8XSgas0RAvw6AKCxRO7N2pNZ+dZ/pvLRA/pHkXPtTgCeL6Fy
isBwjlLuYBlui1qTHzu5Rck=
=P/Oi
-----END PGP SIGNATURE-----

Reply all
Reply to author
Forward
0 new messages