NodeJS Postgres 13.12:错误:{错误:列cnst.consrc不存在

vkc1a9a2  于 12个月前  发布在  Node.js
关注(0)|答案(1)|浏览(180)

我正在使用AWS RDS postgres 13.12和Node js typeServer 0.2.19。

error: { error: column cnst.consrc does not exist
query failed: SELECT "ns"."nspname" AS "table_schema", "t"."relname" AS "table_name", "cnst"."conname" AS "constraint_name", CASE "cnst"."contype" WHEN 'x' THEN pg_get_constraintdef("cnst"."oid", true) ELSE "cnst"."consrc" END AS "expression", CASE "cnst"."contype" WHEN 'p' THEN 'PRIMARY' WHEN 'u' THEN 'UNIQUE' WHEN 'c' THEN 'CHECK' WHEN 'x' THEN 'EXCLUDE' END AS "constraint_type", "a"."attname" AS "column_name" FROM "pg_constraint" "cnst" INNER JOIN "pg_class" "t" ON "t"."oid" = "cnst"."conrelid" INNER JOIN "pg_namespace" "ns" ON "ns"."oid" = "cnst"."connamespace" LEFT JOIN "pg_attribute" "a" ON "a"."attrelid" = "cnst"."conrelid" AND "a"."attnum" = ANY ("cnst"."conkey") WHERE "t"."relkind" = 'r' AND (("ns"."nspname" = 'dbname' AND "t"."relname" = 'users'))

字符串
我试图升级TypeOrm扩展到0.2.45和0.3.6作为最新版本是抛出错误.我试图在本地系统中重新生成相同的错误,它正在发生,而我们没有任何表内的架构,时间是抛出错误与它.但在本地升级TypeOrm扩展版本,它解决了错误.但当我在服务器上尝试相同的解决方案,它抛出不同的错误,如

QueryFailedError: relation "dbname.datamod" does not exist
 
      at new QueryFailedError (src/error/QueryFailedError.ts:9:9)
      at Query.callback (src/driver/postgres/PostgresQueryRunner.ts:178:30)
      at Query.handleError (node_modules/pg/lib/query.js:146:19)
      at Connection.connectedErrorMessageHandler (node_modules/pg/lib/client.js:236:17)
      at Connection.emit (node:events:513:28)
      at Connection.emit (node:domain:489:12)
      at Socket.<anonymous> (node_modules/pg/lib/connection.js:121:12)
      at Socket.emit (node:events:513:28)
      at Socket.emit (node:domain:489:12)
      at addChunk (node:internal/streams/readable:315:12)


降级Postgres可能会解决这个问题,但问题只在开发服务器上,相同的配置在更高的环境中工作。

polhcujo

polhcujo1#

过时的列pg_constraint.consrc已通过Postgres 12从系统目录中删除。
过时的引用"cnst"."consrc"将不得不被替换为.

  • pg_get_expr(cnst.conbin, cnst.conrelid)表示CHECK约束的表达式
  • pg_get_constraintdef(cnst.oid)打印整个约束(而不仅仅是CHECK)。

参见:

  • 查询约束中允许的值

如果updating扩展名会使错误静默,这是有道理的,因为期望当前版本包含该更新是合理的。(新表达式也适用于旧的Postgres版本。)

相关问题