# Type mismatch with ruby-db2 when using set\_primary\_key

**URL:** <https://www.ruby-forum.com/t/type-mismatch-with-ruby-db2-when-using-set-primary-key/118101>\
**Category:** Ruby\
**Created:** [October 23, 2007, 9:31pm UTC](https://www.ruby-forum.com/t/type-mismatch-with-ruby-db2-when-using-set-primary-key/118101 "2007-10-23T21:31:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![teddio](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/b3f665/32.png) [@teddio](https://www.ruby-forum.com/u/teddio)\
**Post date:** [October 23, 2007, 9:31pm UTC](https://www.ruby-forum.com/t/type-mismatch-with-ruby-db2-when-using-set-primary-key/118101/1 "2007-10-23T21:31:07Z")

</div>

I have successfully installed ruby-db2-0.4.4.  
I have successfully connected to DB2 and have displayed the one table  
that I generated a model for. My problem is that this table is part of  
a legacy app and so it does not follow the standards for Rails. My  
primary key for this table is called PKEY instead of id. When I modify  
my model for this table and add set\_primary\_key “pkey”, my sql fails and  
I see that the generated sql looks exactly right except for the places  
that reference PKEY use it as if it were a varchar or char field.  
(things like : where table.pkey = ‘408’). My PKEY field is defined in  
the table as a BIGINT. Am I looking at a problem with ruby-db2 or am I  
just still too new at this?

Thanks  
Mike Hubbard
