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

Can't select column started with chars "not"

I'm making a query with querybuilder, like code:

... $this->item->columns([\i3S\i3Builder\Api\Models\Compra::class . '.NotaFiscal as NotaFiscal']) ...

But the query don't run and return the error: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'Compras.aFiscal' in 'field list'

I tried with columns named as: Notebook, Notacao, Noticia.. and same error, the chars "not" are replaced by nothing.

This occurs with phalcon 4.0.6 and 4.1.0 too



8.4k
Accepted
answer

it is a bug and its been reported many times

https://github.com/phalcon/cphalcon/issues/14918

Quick workaround would be to enclose the field with [] i.e. [not_for_delivery].

This is known bug, unfortunatly it won't be fixed in near patch versions.

As workaround please see my response in your github issue - https://github.com/phalcon/cphalcon/issues/15218#issuecomment-731635482

OK. Thank's for help.