i'm using Redshift through Postgresql connector i got the following error while querying in php codeigniter 3.x, php version 7.0 the model is as follows
$subQuery = "select max(button_history_id) as button_history_id from button_history
where site_id =".$site_id." group by button_history_id ";
$this->another->select('cms_group_id');
$this->another->from('button_history');
$this->another->where('button_history_id IN ('.$subQuery.")");
$this->another->where('cms_group_id !=', '');
$queryGrp = $this->another->get();
$grpIds = array();
foreach($queryGrp->result_array() as $grps){
if($grps['cms_group_id'])
$grpIds = array_merge($grpIds,explode(',', $grps['cms_group_id']));
}
if($grpIds){
$grpIds = array_unique($grpIds);
$this->another->select('content_history_id, (content_id),content_name,content_type');
$this->another->from('content_history');
$this->another->where_in('content_id',$grpIds);
$this->another->group_by('content_history_id,content_id,content_name,content_type');
$this->another->order_by('content_id ,content_history_id',"desc");
$queryG = $this->another->get();
$result1 = $queryG->result_array();
}
but an unwanted E' is appending before the values as follows
ERROR: type "e" does not exist
SELECT "content_history_id", (content_id), "content_name", "content_type" FROM "content_history" WHERE "content_id" IN( E'358', E'357', E'359', E'361', E'408', E'398', E'362', E'366', E'363') GROUP BY "content_history_id", "content_id", "content_name", "content_type" ORDER BY "content_id" DESC, "content_history_id" DESC
this E'358' "E" is causing all the trouble , could anyone has any suggestions please respond. i'm new to this, and hv no idea what is the reson, i have added th info below.
php version :7.0 codeigniter :3.x OS: Centos 6.9
This E is for escaping character in PostgreSQL. See here.
Try to adding a third parameter to where_in
, which avoid escaping.
$this->another->where_in('content_id',$grpIds, false);