# PGError: syntax error in rake db:test:clone

**URL:** <https://www.ruby-forum.com/t/pgerror-syntax-error-in-rake-dbclone/145822>\
**Category:** Rails\
**Created:** [August 14, 2008, 9:41am UTC](https://www.ruby-forum.com/t/pgerror-syntax-error-in-rake-dbclone/145822 "2008-08-14T09:41:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![LesleyW](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/85f322/32.png) [@LesleyW](https://www.ruby-forum.com/u/LesleyW)\
**Post date:** [August 14, 2008, 9:41am UTC](https://www.ruby-forum.com/t/pgerror-syntax-error-in-rake-dbclone/145822/1 "2008-08-14T09:41:19Z")

</div>

Hi all,  
I’m a complete Ruby newbie trying to get a “hello world” Rails app up  
and running. I’m working through the tutorial, and I’m up to “rake  
db:test:clone” on  
[http://wiki.rubyonrails.org/rails/pages/TutorialStepFive](http://wiki.rubyonrails.org/rails/pages/TutorialStepFive).

When I try to run that command, I get the following:

$ rake db:test:clone  
(in /lrw/test3)  
rake aborted!  
PGError: ERROR: syntax error at or near “EXISTS” at character 18  
: DROP DATABASE IF EXISTS lrw\_rubytest\_test

The environment is:  
Debian 4.0 (aka Etch, stable)  
Ruby 1.8.2-1 (debian packaged version)  
libpgsql-ruby1.8 0.7.1-10 (debian packaged version)  
gem v1.2.0  
rails (2.1.0)  
PostgreSQL 8.3.3 (locally compiled, freshly updated)  
and a few other Ruby-related debian packages

I tried running “DROP DATABASE IF EXISTS lrw\_rubytest\_test” directly  
in phpPgAdmin, and still got the syntax error.

Have I got the wrong version of something, perhaps?

---

<div class="post-metadata">

**Author:** ![LesleyW](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/85f322/32.png) [@LesleyW](https://www.ruby-forum.com/u/LesleyW)\
**Post date:** [August 14, 2008, 12:54pm UTC](https://www.ruby-forum.com/t/pgerror-syntax-error-in-rake-dbclone/145822/2 "2008-08-14T12:54:09Z")

</div>

Hi,

the IF EXISTS syntax was introduced in postgres 8.2. So I assume that  
you are still connecting to a postgres server prior to 8.2. Try scrip/  
dbconsole and check the version in the welcome message (first line).

Cheers,

Tobi

---

<div class="post-metadata">

**Author:** ![LesleyW](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/85f322/32.png) [@LesleyW](https://www.ruby-forum.com/u/LesleyW)\
**Post date:** [August 15, 2008, 12:00am UTC](https://www.ruby-forum.com/t/pgerror-syntax-error-in-rake-dbclone/145822/3 "2008-08-15T00:00:36Z")

</div>

Oh, well spotted - thanks for that. It says “Welcome to psql 8.3.3  
(server 8.1.4), the PostgreSQL interactive terminal.”

I’m connecting to a server that hasn’t yet been upgraded to 8.3.3, but  
it should be happening very soon.

Is there a setting I can put into a config file somewhere to use the  
older syntax until the upgrade happens?
