We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Bug regarding metadata data types for PostgreSQL DB

Hello,

i want to report bug i have found regarding data types returned by method \Phalcon\Mvc\Model\MetaData::getDataTypes for PostgreSQL DB.

For columns of datatype double precision or real, this method is returning 2 which wrongly corresponding to \Phalcon\Db\Column ::TYPE_VARCHAR instead of respectively: \Phalcon\Db\Column::TYPE_DOUBLE for double precision and \Phalcon\Db\Column::TYPE_FLOAT for real.

Example dump of print_r of array returned by getDataTypes($model), where $model is subclass of \Phalcon\Mvc Model:

Array ( 
[id] => 0 
[name] => 2 
[is_self_delivery] => 8 
[is_active_for_client] => 8 
[is_active_for_admin] => 8 
[default_delivery_price_netto] => 2 
[is_default] => 8 
[can_delivery_to_client] => 8 
[can_delivery_returns] => 8 
[php_manager_class] => 2 
[default_delivery_price_vat_pct] => 2 
[default_delivery_price_vat_val] => 2 
[default_delivery_price_brutto] => 2 ) 

default_delivery_price_netto and default_delivery_price_brutto - double precision type columns, should be 9 (\Phalcon\Db\Column::TYPE_DOUBLE) instead of 2.

Columns default_delivery_price_vat_pct and default_delivery_price_vat_val - real type columns should be 7 (\Phalcon\Db\Column::TYPE_FLOAT) instead of 2.

Please fix it.

PS. Im running the latest version of Phalcon: 3.1.2

PS 2. Here is list of all PostgreSQL data types, please do necessary connections instead of dumping it to datatype VARCHAR :)

https://www.postgresql.org/docs/9.6/static/datatype.html#DATATYPE-TABLE



43.9k

Hi,

you should open an issue on github: https://github.com/phalcon/cphalcon/issues

You can even try to implement your request by yourself, should be here: https://github.com/phalcon/cphalcon/blob/master/phalcon/db/adapter/pdo/postgresql.zep

zephir language

edited May '17

Thank You, i'll report the issue and maybe even learn Zpehir to fix it on my own.

Edit: Ok i've opened the issue: https://github.com/phalcon/cphalcon/issues/12842