Closed khamyl closed 7 years ago
Dibi is not throwing exception when trying to catch the "Relation Aready Exists!" Error in postgres database.
$sql = array(); $sql[] = " CREATE TABLE ... ( ... CONSTRAINT ..._tid PRIMARY KEY (tid) ) WITH(OIDS=FALSE);"; try{ dibi::query($sql); $this->DBG("OK!",'nl'); }catch(exception $e){ if(preg_match("/relation \"(.*?)\" already exists/", $e->getMessage(), $matches)){ $this->DBG('Already exists!', 'nl'); }else{ \log::error('cron_geom_kostry_table_create_error',$e->getMessage(),4); $this->DBG("ERROR!",'nl'); } }
It juts dies at the "dibi::query($sql);" line :/
But for SEQUENCE:
try{ dibi::query('CREATE SEQUENCE ..._tid_seq;'); $this->DBG(..._tid_seq CREATED!', 'nl'); }catch(\Exception $e){ if(preg_match("/relation \"(.*?)\" already exists/", $e->getMessage(), $matches)){ $this->DBG(..._tid_seq Already exists!', 'nl'); }else{ $this->DBG(..._tid_seq creation ERROR!', 'nl'); \log::error('cron_geom_kostry_seqence_create_error',$e->getMessage(),4); continue; } }
It works fine...
I tested it in separate script and it seems it works fine. So for now Im closing this issue. I will reopen it if I will have more specific details regarding this error (if it will be a dibi error at all).
Description
Dibi is not throwing exception when trying to catch the "Relation Aready Exists!" Error in postgres database.
Steps To Reproduce
It juts dies at the "dibi::query($sql);" line :/
But for SEQUENCE:
It works fine...