Hello, I have a table “category” with a field “locales” that is an enum array (category_locales_enum[]
).
Feature(s) impacted
- Filtering on an enum array
- Sorting on an enum array
Observed behavior
Filtering or sorting in FA dashboard on this array throws an error. FA casts the array enum as enum_public.category_locales[]
instead of category_locales_enum[]
). The enum_public.category_locales[]
doesn’t appear in our .forestadmin-schema.json so I assume it’s being generated somewhere at runtime. If the fix would take long, would you mind pointing me to where it is being generated so that I can patch a workaround in the meantime, thanks.
Expected behavior
Filtering or sorting in FA dashboard works.
Failure Logs
The stacktrace is sadly not very helpful here.
[forest] 🌳🌳🌳 Unexpected error: type "enum_public.category_locales[]" does not exist
{
"name": "SequelizeDatabaseError",
"parent": {
"length": 118,
"name": "error",
"severity": "ERROR",
"code": "42704",
"position": "115",
"file": "parse_type.c",
"line": "270",
"routine": "typenameType",
"sql": "SELECT count(*) AS \"count\" FROM \"public\".\"category\" AS \"category\" WHERE \"category\".\"locales\" @> ARRAY['en']::\"enum_public.category_locales\"[];"
},
"original": {
"length": 118,
"name": "error",
"severity": "ERROR",
"code": "42704",
"position": "115",
"file": "parse_type.c",
"line": "270",
"routine": "typenameType",
"sql": "SELECT count(*) AS \"count\" FROM \"public\".\"category\" AS \"category\" WHERE \"category\".\"locales\" @> ARRAY['en']::\"enum_public.category_locales\"[];"
},
"sql": "SELECT count(*) AS \"count\" FROM \"public\".\"category\" AS \"category\" WHERE \"category\".\"locales\" @> ARRAY['en']::\"enum_public.category_locales\"[];",
"error@context": {
"_ns_name": "forest-admin",
"id": 7941
},
"stack": "SequelizeDatabaseError: type \"enum_public.category_locales[]\" does not exist\n at Query.formatError (/path-to-project/forest-admin/node_modules/sequelize/lib/dialects/postgres/query.js:366:16)\n at /path-to-project/forest-admin/node_modules/sequelize/lib/dialects/postgres/query.js:72:18\n at clsBind (/path-to-project/forest-admin/node_modules/cls-hooked/context.js:172:17)\n at tryCatcher (/path-to-project/forest-admin/node_modules/bluebird/js/release/util.js:16:23)\n at Promise._settlePromiseFromHandler (/path-to-project/forest-admin/node_modules/bluebird/js/release/promise.js:547:31)\n at Promise._settlePromise (/path-to-project/forest-admin/node_modules/bluebird/js/release/promise.js:604:18)\n at Promise._settlePromise0 (/path-to-project/forest-admin/node_modules/bluebird/js/release/promise.js:649:10)\n at Promise._settlePromises (/path-to-project/forest-admin/node_modules/bluebird/js/release/promise.js:725:18)\n at _drainQueueStep (/path-to-project/forest-admin/node_modules/bluebird/js/release/async.js:93:12)\n at _drainQueue (/path-to-project/forest-admin/node_modules/bluebird/js/release/async.js:86:9)\n at Async._drainQueues (/path-to-project/forest-admin/node_modules/bluebird/js/release/async.js:102:5)\n at Immediate.Async.drainQueues [as _onImmediate] (/path-to-project/forest-admin/node_modules/bluebird/js/release/async.js:15:14)\n at processImmediate (node:internal/timers:478:21)\n at process.callbackTrampoline (node:internal/async_hooks:130:17)"
}
Context
- Project name: contact me by email if necessary
- Team name: contact me by email if necessary
- Environment name: development
- Agent & database:
{
"liana": "forest-express-sequelize",
"liana_version": "9.3.7",
"stack": {
"database_type": "postgres",
"engine": "nodejs",
"engine_version": "20.9.0",
"orm_version": "5.22.5"
}
}