diff --git a/pegjs/postgresql.pegjs b/pegjs/postgresql.pegjs index 3d2d0ec7..15246db7 100644 --- a/pegjs/postgresql.pegjs +++ b/pegjs/postgresql.pegjs @@ -1315,7 +1315,7 @@ create_column_definition_list create_column_definition = c:column_ref __ - d:data_type __ + d:(data_type / double_quoted_ident) __ cdo:column_definition_opt_list? { /* => { @@ -1335,6 +1335,7 @@ create_column_definition } */ columnList.add(`create::${c.table}::${c.column.expr.value}`) + if (d.type === 'double_quote_string') d = { dataType: `"${d.value}"` } return { column: c, definition: d, diff --git a/test/postgres.spec.js b/test/postgres.spec.js index d4c62377..dbdad739 100644 --- a/test/postgres.spec.js +++ b/test/postgres.spec.js @@ -1595,6 +1595,13 @@ describe('Postgres', () => { `CREATE TABLE "public"."tnotok" ("id" SERIAL CONSTRAINT users_PK PRIMARY KEY, description TEXT NOT NULL DEFAULT ''::TEXT)`, ] }, + { + title: 'create table with quoted data type', + sql: [ + 'CREATE TABLE "User" ("gender" "Gender" NOT NULL);', + 'CREATE TABLE "User" ("gender" "Gender" NOT NULL)', + ] + }, ] function neatlyNestTestedSQL(sqlList){ sqlList.forEach(sqlInfo => {