# What to do when Rails generated select statements don't work

**URL:** <https://www.ruby-forum.com/t/what-to-do-when-rails-generated-select-statements-dont-work/90481>\
**Category:** Rails\
**Created:** [March 29, 2007, 4:33am UTC](https://www.ruby-forum.com/t/what-to-do-when-rails-generated-select-statements-dont-work/90481 "2007-03-29T04:33:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![eriklane](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/977dab/32.png) [@eriklane](https://www.ruby-forum.com/u/eriklane)\
**Post date:** [March 29, 2007, 4:33am UTC](https://www.ruby-forum.com/t/what-to-do-when-rails-generated-select-statements-dont-work/90481/1 "2007-03-29T04:33:06Z")

</div>

Running FC6 with RoR 1.1.6  
I’m using a custom type called ‘uuid’ based on code from this project.  
[http://gborg.postgresql.org/project/pguuid/projdisplay.php](http://gborg.postgresql.org/project/pguuid/projdisplay.php)

Here’s a description of the ksessions table.

Table “public.ksessions”  
Column | Type |  
Modifiers  
-------------±-------------------------  
±-----------------------------  
title | text | not null  
description | text | not null  
public | boolean | not null default false  
id | uuid | not null default uuid\_time()  
user\_id | uuid | not null

Here’s the automatically generated SQL that returns 0 rows…

## kapture\_development=\> select ksessions.“id” from ksessions where (ksessions.“id” = ‘67794c52-d0cd-11db-9a81-000d5679aec6’); id

(0 rows)

Here’s my SQL that returns the exact row I’m looking for…

## kapture\_development=\> select ksessions.“id” from ksessions where uuid\_eq(ksessions.“id”,‘67794c52-d0cd-11db-9a81-000d5679aec6’) = ‘1’; id

67794c52-d0cd-11db-9a81-000d5679aec6  
(1 row)

Where in the world do I fix this? I imagine I need to tell something  
to  
use this uuid\_eq function instead of the ‘=’ operator for each  
comparison/look up.

I’m guessing this involves messing with Rails or Active\_RBAC somehow.

Any thoughts would be appreciated.
