can't query numeric field I can't seem to query on a field of type "numeric".

From hook_schema:

'id' =&gt; array(
  'description' =&gt; "ID",
  'type' =&gt; 'numeric',
  'unsigned' =&gt; TRUE,
  'precision' =&gt; 20,
  'scale' =&gt; 0,
  'not null' =&gt; TRUE,
  'default' =&gt; 0,
),


if I do something simple like the following code, I don't get anything.

$query = db_select('tablename', 't')
  -&gt;fields('t', array('nid'))
  -&gt;condition('id', $id, '=');


However, if I execute the following query on PHPMyAdmin, I get a row.

SELECT * FROM `tablename` WHERE id = 195755377227337728;


I did try to type cast the id with (int) $id, but that didn't work either.

Do you have any thought?
Two things that might be causing the problem:


You need to execute the query: $result = $query->execute();
The id you gave is HUGE, and I don't know if it would ever work. Drupal comes with the nid column set to a length of 10.  Even if you've accounted for that, the max INT column size in MySQL is 4294967295 and your ID is 195755377227337728.  Theoretically you could use BIG INT instead of INT.  See: MySQL column type sizes


Also, try this Static Query instead of db_select():

$result = db_query("SELECT nid FROM {table} WHERE nid = :nid", array(':nid' =&gt; $nid,));