'serialized' field in schema still needs manual unserialization? I've modified my schema so that I can store an array of items in one field:

"required_product" =&gt; array(
  "type" =&gt; "text",
  "length" =&gt; 'medium',
  "not null" =&gt; TRUE,
  "default" =&gt; "",
  "serialize" =&gt; true,
),


This works great when using drupal_write_record, as the array data is correctly serialized before putting it into insert/update query and executing.

However, I still have to manually serialize when I extract the data - example:

$form_state["values"] = db_fetch_array(db_query("SELECT * FROM {amh_shop_discounts} WHERE discount_id=%d", $discount_id));
$form_state['values']['required_product'] = unserialize($form_state['values']['required_product']);


This is less useful - shouldn't it do both?

Currently running Drupal 6.22
This is just a guess, so correct me if I'm wrong...

I think that automatic unserialization is not possible because the schema is not loaded by db_query. While drupal_write_record() loads the schema definition before writing to the database, db_query simply executes the query string you put into it, without knowing which schema definition the query relates to.