Invalid SQL generated with PostgreSQL 8.2.3

Hey,

Using Ruby 1.8.5, postgres-pr-0.4.0, activerecord-1.15.2, Rails 1.2.2 and PostgreSQL 8.2.3. I'm following the O'Reilly book "Ruby on Rails", so you can tell I know precious little of what I'm doing :wink:

Well, I've created some models, and was working through examples, and executed the following from a console:

show = Slideshow.find 1

=> #<Slideshow:0x7f2d7588 @attributes={"name"=>"Interesting pictures", "id"=>"1", "created_at"=>"2007-02-17 19:41:30.703"}>

show.slides.first.photo.filename

=> "balboa_park.jpg"

show.slides.first.move_to_bottom

ActiveRecord::StatementInvalid: PGError: ERROR: argument of AND must be type boolean, not type integer : UPDATE slides SET position = (position - 1) WHERE (slideshow_id AND position > 1)         from /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/ active_record/connection_adapters/abstract_adapter.rb:128:in `log'         from /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/ active_record/connection_adapters/postgresql_adapter.rb:152:in `execute'         from /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/ active_record/connection_adapters/postgresql_adapter.rb:162:in `update'         from /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/ active_record/base.rb:497:in `update_all'         from /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/ active_record/acts/list.rb:210:in `decrement_positions_on_lower_items'         from /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/ active_record/acts/list.rb:106:in `move_to_bottom'         from /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/ active_record/connection_adapters/abstract/database_statements.rb: 59:in `transaction'         from /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/ active_record/transactions.rb:95:in `transaction'         from /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/ active_record/acts/list.rb:105:in `move_to_bottom'         from (irb):3

The error is pretty specific. I'm thinking the where clause should be (slideshow_id NOTNULL AND position > 1)?

Any help?

Thanks, Rob