civicrm/civicrm-core — pull request #1718 by monishdeb (2013-10-01 08:24:29+00:00)
Title: CRM-13426 fix - Fatal error on search that includes a smart group created by custom search

Upon Custom search result usually contact_id attribute is used in build query, but this doesn't reflect in the query for civicrm_group_contact_cache insertion query as it always select id which then results into a "DB Error: Unkown Column id" during creating a Smart Group on that result.

Fix contain the usage of $idName which rightfully contain the name 'contact_id' and is safe to use as I checked.