R
R
Roman Makarov2013-10-06 22:23:10
PostgreSQL
Roman Makarov, 2013-10-06 22:23:10

Yii active record and user-defined types in postgres?

I really like postgres for the richest functionality, including user-defined types. I wonder how Active Record works with them in yii, in particular CDbCriteria.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
Tehnomag, 2013-10-07
@vollossy

Judging by the sources, all user-defined data types are translated into a string

protected function extractType($dbType)
 {
  if(strpos($dbType,'[')!==false || strpos($dbType,'char')!==false || strpos($dbType,'text')!==false)
   $this->type='string';
  else if(strpos($dbType,'bool')!==false)
   $this->type='boolean';
  else if(preg_match('/(real|float|double)/',$dbType))
   $this->type='double';
  else if(preg_match('/(integer|oid|serial|smallint)/',$dbType))
   $this->type='integer';
  else
   $this->type='string';
 }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question