You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Sequelize.ENUM does not support the substring COMMENT #9149
I want the sync to create a table named "table" with the column "column" with a type "enum_table_column" with the value "COMMENT".
What is actually happening?
The sync errors while creating the table. This error occurs for any string containing the substring COMMENT. It seems that Sequelize is interpreting the keyword COMMENT as the SQL COMMENT operator.
CREATE TABLE IF NOT EXISTS "contacts" ("id" SERIAL , "col" ENUM(', "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL, PRIMARY KEY ("id")); COMMENT');
Dialect: postgres Dialect version: 9.6.6 Sequelize version: 4.32.7 Tested with latest release: No
@hisorange Thank you for your response, unfortunately we have the same result using Sequelize.ENUM('COMMENT'), as well as Sequelize.ENUM('COMMENT', 'OTHER_VALUE').
We've also tried using Sequelize.literal or Sequelize.cast, nothing do!
@poupouch
I've tried to recreate this issue but I couldn't. This is the query that gets executed:
DROP TYPE IF EXISTS "public"."enum_tables_column"; CREATE TYPE "public"."enum_tables_column" AS ENUM('COMMENT');
CREATE TABLE IF NOT EXISTS "tables" ("id" SERIAL , "column" "public"."enum_tables_column", "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL, PRIMARY KEY ("id"));
Which makes sense because Postgres handles ENUM differently and in a separate query.
I've used code you've provided
Sequelize: latest
Postgres: 10.4 @sushantdhiman
Activity
hisorange commentedon Mar 7, 2018
Define it like this:
Based on this source
p-salmon commentedon Mar 7, 2018
@hisorange Thank you for your response, unfortunately we have the same result using
Sequelize.ENUM('COMMENT'), as well asSequelize.ENUM('COMMENT', 'OTHER_VALUE').We've also tried using Sequelize.literal or Sequelize.cast, nothing do!
hisorange commentedon Mar 8, 2018
@poupouch Sorry! I was tired when found the issue and didn't read it well, ofc it will not solve your issue. But gona look into it, got curious now :D
dspigarelli commentedon Jun 20, 2018
I believe the issue is this
.indexOf('COMMENT')is too broad and catching non-comment strings:sequelize/lib/dialects/postgres/query-generator.js
Lines 50 to 55 in 9b1ca37
mirkojotic commentedon Jul 6, 2018
@poupouch
I've tried to recreate this issue but I couldn't. This is the query that gets executed:
Which makes sense because Postgres handles ENUM differently and in a separate query.
I've used code you've provided
Sequelize: latest
Postgres: 10.4
@sushantdhiman