{"record":{"id":"1463a3a99d7906a7","repo":"phalcon/cphalcon","slug":"unrecognized-sqlite-data-type-at-column-column","errorCode":null,"errorMessage":"Unrecognized SQLite data type at column {column}","messagePattern":"Unrecognized SQLite data type at column (.+?)","errorType":"exception","errorClass":"Phalcon\\Db\\Exceptions\\UnrecognizedDataType","httpStatus":null,"severity":"error","filePath":"phalcon/Db/Dialect/Sqlite.zep","lineNumber":583,"sourceCode":"            case Column::TYPE_TINYBLOB:\n                if empty columnSql {\n                    let columnSql .= \"TINYBLOB\";\n                }\n\n                break;\n\n            case Column::TYPE_VARCHAR:\n                if empty columnSql {\n                    let columnSql .= \"VARCHAR\";\n                }\n\n                let columnSql .= this->getColumnSize(column);\n\n                break;\n\n            default:\n                if empty columnSql {\n                    throw new UnrecognizedDataType(\"SQLite\", column->getName());\n                }\n\n                let typeValues = column->getTypeValues();\n                if !empty typeValues {\n                    if typeof typeValues == \"array\" {\n                        var value, valueSql;\n\n                        let valueSql = \"\";\n\n                        for value in typeValues {\n                            let valueSql .= \"\\\"\" . addcslashes(value, \"\\\"\") . \"\\\", \";\n                        }\n\n                        let columnSql .= \"(\" . substr(valueSql, 0, -2) . \")\";\n                    } else {\n                        let columnSql .= \"(\\\"\" . addcslashes(typeValues, \"\\\"\") . \"\\\")\";\n                    }\n                }","sourceCodeStart":565,"sourceCodeEnd":601,"githubUrl":"https://github.com/phalcon/cphalcon/blob/b7419de9cd0a8a3f48441ead84c9f8415d463e25/phalcon/Db/Dialect/Sqlite.zep#L565-L601","documentation":"Thrown while the SQLite dialect renders column DDL: the Column object's type constant fell through the dialect's type switch and no column SQL had been generated, so the dialect cannot express the column in CREATE TABLE/ADD COLUMN. UnrecognizedDataType carries the dialect name ('SQLite') and the offending column name.","triggerScenarios":"new Column('status', ['type' => $rawInt]) where the integer is not a Column::TYPE_* constant the SQLite dialect renders (unvalidated value from config/JSON); passing a string type name instead of a constant; column definitions shared from another dialect that hit the unmapped default branch.","commonSituations":"Column types read from user- or config-supplied data; casting bugs where a name like 'varchar' is used instead of Column::TYPE_VARCHAR; definitions ported from MySQL migrations that assume a wider type mapping.","solutions":["Construct columns with Phalcon\\Db\\Column type constants (Column::TYPE_INTEGER, Column::TYPE_VARCHAR, Column::TYPE_TEXT, ...)","When the type comes from dynamic input, resolve it via defined(Column::class . '::TYPE_' . $name) and fall back to a safe constant such as TYPE_TEXT","For exotic types, store as TEXT/BLOB on SQLite or subclass the dialect to extend the type mapping"],"exampleFix":"// before\nnew Column('status', ['type' => $config['column_type']]); // raw unvalidated value\n\n// after\nuse Phalcon\\Db\\Column;\n$const = Column::class . '::TYPE_' . strtoupper((string) $config['column_type']);\n$type  = defined($const) ? constant($const) : Column::TYPE_TEXT;\nnew Column('status', ['type' => $type]);","handlingStrategy":"validation","validationCode":"// when the type comes from dynamic input, resolve a real constant and fall back to TEXT\n$const = \\Phalcon\\Db\\Column::class . '::TYPE_' . strtoupper((string) $config['column_type']);\n$type  = defined($const) ? \\constant($const) : \\Phalcon\\Db\\Column::TYPE_TEXT;\n$column = new \\Phalcon\\Db\\Column('status', ['type' => $type]);","typeGuard":"function isColumnTypeConstant(int $type): bool\n{\n    $constants = (new \\ReflectionClass(\\Phalcon\\Db\\Column::class))->getConstants();\n    return in_array($type, $constants, true);\n}","tryCatchPattern":"try {\n    $sql = $dialect->createTable('posts', null, $definition);\n} catch (\\Phalcon\\Db\\Exceptions\\UnrecognizedDataType $e) {\n    throw new InvalidArgumentException('Column type not renderable by this dialect: ' . $e->getMessage(), 0, $e);\n}","preventionTips":["Always construct Column objects with Column::TYPE_* constants, never raw integers or type name strings","Whitelist column types per target dialect in config-driven schemas; map exotic types to TEXT/BLOB on SQLite","Unit-test every dynamic column definition against each dialect your app ships"],"tags":["sqlite","phalcon-db","ddl","column-type","schema-definition"],"backgroundTag":"unsupported-column-type","analyzedSha":"b7419de9cd0a8a3f48441ead84c9f8415d463e25","analyzedAt":"2026-08-21T06:21:18.811Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}