# Problems testing on 1.1 and postgresql

**URL:** <https://www.ruby-forum.com/t/problems-testing-on-1-1-and-postgresql/56738>\
**Category:** Rails\
**Created:** [April 3, 2006, 2:11pm UTC](https://www.ruby-forum.com/t/problems-testing-on-1-1-and-postgresql/56738 "2006-04-03T14:11:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeroen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bbe5ce/32.png) [@jeroen](https://www.ruby-forum.com/u/jeroen)\
**Post date:** [April 3, 2006, 2:11pm UTC](https://www.ruby-forum.com/t/problems-testing-on-1-1-and-postgresql/56738/1 "2006-04-03T14:11:48Z")

</div>

Hi,

I get errors doing this:

1. createdb myapp\_test
2. rake db:test:clone\_structure
3. rake test:units

rake aborted!  
PGError: ERROR: relation “matches” already exists

I’m using the :sql schema format because there are some problems with  
postgres and the :ruby schema format

config.active\_record.schema\_format = :sql

It seems rake test:units is trying to create the tables again, is this a  
bug?

Jeroen

---

<div class="post-metadata">

**Author:** ![jeroen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bbe5ce/32.png) [@jeroen](https://www.ruby-forum.com/u/jeroen)\
**Post date:** [April 3, 2006, 2:15pm UTC](https://www.ruby-forum.com/t/problems-testing-on-1-1-and-postgresql/56738/2 "2006-04-03T14:15:08Z")

</div>

And if I do this:

1. dropdb myapp\_test
2. createdb myapp\_test
3. rake test:units

I get an error:

…E…  
Finished in 1.094318 seconds.

1. Error:  
test\_insert(PlayerTest):  
ActiveRecord::StatementInvalid: PGError: ERROR: relation  
“vw\_player\_matches” does not exist  
: SELECT a.attname, format\_type(a.atttypid, a.atttypmod),  
d.adsrc, a.attnotnull  
FROM pg\_attribute a LEFT JOIN pg\_attrdef d  
ON a.attrelid = d.adrelid AND a.attnum = d.adnum  
WHERE a.attrelid = ‘vw\_player\_matches’::regclass  
AND a.attnum \> 0 AND NOT a.attisdropped  
ORDER BY a.attnum

This looks like it silently creating the db structure using the :ruby  
schema format which does not dump views  
([http://dev.rubyonrails.org/ticket/4112](http://dev.rubyonrails.org/ticket/4112))

Jeroen

---

<div class="post-metadata">

**Author:** ![jeroen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bbe5ce/32.png) [@jeroen](https://www.ruby-forum.com/u/jeroen)\
**Post date:** [April 3, 2006, 2:31pm UTC](https://www.ruby-forum.com/t/problems-testing-on-1-1-and-postgresql/56738/3 "2006-04-03T14:31:50Z")

</div>

I am stupid.

I didn’t actually add this:  
config.active\_record.schema\_format = :sql

After I did it works fine.  
(but there definitely is a problem with the default :ruby schema dump  
format)

Jeroen
