# Error in rails 1.2.3 activerecord

**URL:** <https://www.ruby-forum.com/t/error-in-rails-1-2-3-activerecord/112926>\
**Category:** Rails\
**Created:** [August 24, 2007, 3:26pm UTC](https://www.ruby-forum.com/t/error-in-rails-1-2-3-activerecord/112926 "2007-08-24T15:26:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bitsmith](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/9de053/32.png) [@bitsmith](https://www.ruby-forum.com/u/bitsmith)\
**Post date:** [August 24, 2007, 3:26pm UTC](https://www.ruby-forum.com/t/error-in-rails-1-2-3-activerecord/112926/1 "2007-08-24T15:26:53Z")

</div>

i’m a rails nuby so i don’t know where to fix this in the activerecord  
module…

there is no such column in the sys.view.user\_constraints.  
SELECT uc.index\_name FROM user\_constraints uc WHERE uc.constraint\_type =  
‘P’

this prevents me from doing a rake test:functionals …as in below…

C:\railsspace\>c:\ruby186\ruby\bin\ruby c:\ruby186\ruby\bin\rake  
test:functionals --trace  
(in C:/railsspace)  
\*\* Invoke test:functionals (first\_time)  
\*\* Invoke db:test:prepare (first\_time)  
\*\* Invoke environment (first\_time)  
\*\* Execute environment  
\*\* Execute db:test:prepare  
\*\* Invoke db:test:clone (first\_time)  
\*\* Invoke db:schema:dump (first\_time)  
\*\* Invoke environment  
\*\* Execute db:schema:dump  
\*\* Invoke db:test:purge (first\_time)  
\*\* Invoke environment  
\*\* Execute db:test:purge  
\*\* Execute db:test:clone  
\*\* Invoke db:schema:load (first\_time)  
\*\* Invoke environment  
\*\* Execute db:schema:load  
rake aborted!  
./db/schema.rb:9: syntax error, unexpected tIDENTIFIER, expecting kDO or  
‘{’ or  
‘(’  
c:/ruby186/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active\_support/de  
pendencies.rb:488:in `load' c:/ruby186/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/de pendencies.rb:488:in`load’  
c:/ruby186/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active\_support/de  
pendencies.rb:342:in `new_constants_in' c:/ruby186/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/de pendencies.rb:488:in`load’  
c:/ruby186/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/tasks/databases.rake:31  
c:/ruby186/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:399:in  
`call' c:/ruby186/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:399:in`execute’  
c:/ruby186/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:399:in  
`each' c:/ruby186/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:399:in`execute’  
c:/ruby186/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:369:in  
`invoke' c:/ruby186/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:362:in`synchroniz  
e’  
c:/ruby186/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:362:in  
`invoke' c:/ruby186/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/tasks/databases.rake:76 c:/ruby186/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:399:in`call’  
c:/ruby186/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:399:in  
`execute' c:/ruby186/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:399:in`each’  
c:/ruby186/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:399:in  
`execute' c:/ruby186/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:369:in`invoke’  
c:/ruby186/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:362:in  
`synchroniz e' c:/ruby186/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:362:in`invoke’  
c:/ruby186/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/tasks/databases.rake:153  
c:/ruby186/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:399:in  
`call' c:/ruby186/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:399:in`execute’  
c:/ruby186/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:399:in  
`each' c:/ruby186/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:399:in`execute’  
c:/ruby186/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:369:in  
`invoke' c:/ruby186/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:362:in`synchroniz  
e’  
c:/ruby186/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:362:in  
`invoke' c:/ruby186/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:376:in`invoke\_pre  
requisites’  
c:/ruby186/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:1021:in  
`each' c:/ruby186/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:1021:in`send’  
c:/ruby186/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:1021:in  
`each' c:/ruby186/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:375:in`invoke\_pre  
requisites’  
c:/ruby186/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:368:in  
`invoke' c:/ruby186/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:362:in`synchroniz  
e’  
c:/ruby186/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:362:in  
`invoke' c:/ruby186/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:1935:in`run’  
c:/ruby186/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:1935:in  
`each' c:/ruby186/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:1935:in`run’  
c:/ruby186/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/bin/rake:7  
c:/ruby186/ruby/bin/rake:16:in `load’  
c:/ruby186/ruby/bin/rake:16

# This file is autogenerated. Instead of editing this file, please use

the

# migrations feature of ActiveRecord to incrementally modify your

database, and

# then regenerate this schema definition.

ActiveRecord::Schema.define(:version =\> 2) do

# Could not dump table “users” because of following

ActiveRecord::StatementInvalid

# OCIError: ORA-00904: invalid column name: SELECT

lower(i.index\_name) as index\_name, i.uniqueness, lower(c.column\_name) as  
column\_name  
FROM user\_indexes i, user\_ind\_columns c  
WHERE i.table\_name = ‘USERS’  
AND c.index\_name = i.index\_name  
AND i.index\_name NOT IN (SELECT uc.index\_name FROM  
user\_constraints uc WHERE uc.constraint\_type = ‘P’)  
ORDER BY i.index\_name, c.column\_position

end

---

<div class="post-metadata">

**Author:** ![bitsmith](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/9de053/32.png) [@bitsmith](https://www.ruby-forum.com/u/bitsmith)\
**Post date:** [August 24, 2007, 3:27pm UTC](https://www.ruby-forum.com/t/error-in-rails-1-2-3-activerecord/112926/2 "2007-08-24T15:27:55Z")

</div>

Dave R. adds: i’m using oracle 8i

---

<div class="post-metadata">

**Author:** ![bitsmith](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/9de053/32.png) [@bitsmith](https://www.ruby-forum.com/u/bitsmith)\
**Post date:** [August 24, 2007, 6:23pm UTC](https://www.ruby-forum.com/t/error-in-rails-1-2-3-activerecord/112926/3 "2007-08-24T18:23:25Z")

</div>

On Fri, 24 Aug 2007, Dave R. wrote:

> i’m a rails nuby so i don’t know where to fix this in the activerecord  
> module…
> 
> there is no such column in the sys.view.user\_constraints.  
> SELECT uc.index\_name FROM user\_constraints uc WHERE uc.constraint\_type =  
> ‘P’

It would help to see the source from which the tables are constructed  
(SQL, migrations,…)

> this prevents me from doing a rake test:functionals …as in below…
> 
> C:\railsspace\>c:\ruby186\ruby\bin\ruby c:\ruby186\ruby\bin\rake  
> test:functionals --trace  
> (in C:/railsspace)  
> \*\* Invoke test:functionals (first\_time)  
> […]  
> \*\* Execute db:schema:load  
> rake aborted!  
> ./db/schema.rb:9: syntax error, unexpected tIDENTIFIER, expecting kDO or  
> ‘{’ or  
> ‘(’  
> c:/ruby186/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active\_support/de  
> […in rake…]  
> `run' c:/ruby186/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/bin/rake:7 c:/ruby186/ruby/bin/rake:16:in`load’  
> c:/ruby186/ruby/bin/rake:16

So this is your schema.rb??

> # OCIError: ORA-00904: invalid column name: SELECT

This is Oracle? I’m unfamiliar with that.

> lower(i.index\_name) as index\_name, i.uniqueness, lower(c.column\_name) as  
> column\_name  
> FROM user\_indexes i, user\_ind\_columns c  
> WHERE i.table\_name = ‘USERS’  
> AND c.index\_name = i.index\_name  
> AND i.index\_name NOT IN (SELECT uc.index\_name FROM  
> user\_constraints uc WHERE uc.constraint\_type = ‘P’)  
> ORDER BY i.index\_name, c.column\_position
> 
> end

It’s hard (for me) to tell where this is coming from without a bit more  
info on how your tables are declared.

```
    Hugh
```
