描述错误
执行任何类型的插入时,架构不匹配。
错误:列“值”为jsonb类型,但表达式为文本类型
重现
使用最新的资源和postgres。 尝试使用v12和v13。
预期行为
做插入没有错误。
屏幕截图
etherpad_1 | [2020-09-08 20:37:50.541] [错误]控制台-错误:列“值”的类型为jsonb,但表达式的类型为文本
etherpad_1 | 在Parser.parseErrorMessage(/opt/etherpad-lite/src/node_modules/pg-protocol/dist/parser.js:278:15)
etherpad_1 | 在Parser.handlePacket(/opt/etherpad-lite/src/node_modules/pg-protocol/dist/parser.js:126:29)
etherpad_1 | 在Parser.parse(/opt/etherpad-lite/src/node_modules/pg-protocol/dist/parser.js:39:38)
etherpad_1 | 在Socket.stream.on(/opt/etherpad-lite/src/node_modules/pg-protocol/dist/index.js:8:42)
etherpad_1 | 在Socket.emit(events.js:198:13)
etherpad_1 | 在Socket.EventEmitter.emit(domain.js:448:20)
etherpad_1 | 在addChunk(_stream_visible.js:288:12)
etherpad_1 | 在可读AddChunk(_stream_visible.js:269:11)
etherpad_1 | 在Socket.Readable.push(_stream_visible.js:224:10)
etherpad_1 | 在TCP.onStreamRead [读取时](internal / stream_base_commons.js:94:17)
桌面(请完成以下信息):
不适用
智能手机(请填写以下信息):
不适用
其他背景
这已通过docker容器进行了测试。
这主要是一个我应该使用发行版时使用最新资源的问题。
我已经在1.8.4上尝试过,可以确认我没有收到此错误。 我已经相应地更新了问题。
除了1.8.5确实包含此bug,所以哎呀。
固定在c8361a211a1e6bfbbc006933f48d48ca51857c71
固定在c8361a2
我仍然明白。
你有没有先拉然后bin / run.sh?
您将需要更新ueber,bin / run.sh将执行此操作。 不要使用fastrun
是的,我总是想出bin/run.sh
。
它已更新为"ueberdb2": "^0.5.2"
测试通过了。
您可以尝试新的pg dB plz吗? 我想看看以前的提交是否破坏了您的数据库。
您可以尝试新的pg dB plz吗? 我想看看以前的提交是否破坏了您的数据库。
当然,让我尝试。
您可以尝试新的pg dB plz吗? 我想看看以前的提交是否破坏了您的数据库。
实际上,由于我的开发环境,我在每个版本上都得到一个新的pg db。
然后进行Peep Travis配置,以查看我们如何为ueberdb测试创建数据库。 您将不需要此处的ueber dB回购
看来我们应该使用以下回购协议吗?
https://github.com/ether/ueberDB#dirtyref
master
嗨,我在1.8.5上也有这个问题。 在找到解决方案之前,您可以重新打开此问题吗? (因此更容易找到它!)
谢谢!
抄送@Gared
我仍然有这个问题甚至更改为回购https://github.com/ether/ueberDB(master )
同样在这里:
[2020-09-11 11:36:24.449] [ERROR] console - error: column "value" is of type jsonb but expression is of type text
at Parser.parseErrorMessage (/usr/local/var/etherpad/repo/src/node_modules/pg-protocol/dist/parser.js:278:15)
at Parser.handlePacket (/usr/local/var/etherpad/repo/src/node_modules/pg-protocol/dist/parser.js:126:29)
at Parser.parse (/usr/local/var/etherpad/repo/src/node_modules/pg-protocol/dist/parser.js:39:38)
at Socket.<anonymous> (/usr/local/var/etherpad/repo/src/node_modules/pg-protocol/dist/index.js:8:42)
at Socket.emit (events.js:315:20)
at Socket.EventEmitter.emit (domain.js:483:12)
at addChunk (_stream_readable.js:295:12)
at readableAddChunk (_stream_readable.js:271:9)
at Socket.Readable.push (_stream_readable.js:212:10)
at TCP.onStreamRead (internal/stream_base_commons.js:186:23)
[2020-09-11 11:36:24.463] [ERROR] console - TypeError: Cannot read property 'name' of null
at Client._handleParseComplete (/usr/local/var/etherpad/repo/src/node_modules/pg/lib/client.js:358:26)
at Connection.emit (events.js:315:20)
at Connection.EventEmitter.emit (domain.js:483:12)
at /usr/local/var/etherpad/repo/src/node_modules/pg/lib/connection.js:109:12
at Parser.parse (/usr/local/var/etherpad/repo/src/node_modules/pg-protocol/dist/parser.js:40:17)
at Socket.<anonymous> (/usr/local/var/etherpad/repo/src/node_modules/pg-protocol/dist/index.js:8:42)
at Socket.emit (events.js:315:20)
at Socket.EventEmitter.emit (domain.js:483:12)
at addChunk (_stream_readable.js:295:12)
at readableAddChunk (_stream_readable.js:271:9)
settings.json
:{
"dbSettings" : {
"user" : "etherpad",
"host" : "localhost",
"port" : 5432,
"password": "xxx",
"database": "etherpad",
},
"padOptions": {
"noColors": false,
"showControls": true,
"showChat": true,
"showLineNumbers": true,
"useMonospaceFont": false,
"userName": false,
"userColor": false,
"rtl": false,
"alwaysShowChat": false,
"chatAndUsers": false,
"lang": "de-de"
},
"suppressErrorsInPadText": false,
"requireSession": false,
"editOnly": true,
"sessionNoPassword": false,
"minify": true,
"maxAge": 21600,
"abiword": null,
"soffice": null,
"tidyHtml": null,
"allowUnknownFileEnds": true,
"requireAuthentication": false,
"requireAuthorization": false,
"trustProxy": true,
"disableIPlogging": true,
"automaticReconnectionTimeout": 5,
"users": {
"admin": {
"hash": "xxx",
"is_admin": true
}
},
"socketTransportProtocols" : ["xhr-polling", "jsonp-polling", "htmlfile"],
"loadTest": false,
"exposeVersion": false,
"loglevel": "WARN",
"logconfig" :
{ "appenders": [
{ "type": "console" }
]
}
}
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;
CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
CREATE FUNCTION public.ueberdb_insert_or_update(character varying, text) RETURNS void
LANGUAGE plpgsql
AS $_$ BEGIN IF EXISTS( SELECT * FROM store WHERE key = $1 ) THEN UPDATE store SET value = $2 WHERE key = $1; ELSE INSERT INTO store(key,value) VALUES( $1, $2 ); END IF; RETURN; END; $_$;
ALTER FUNCTION public.ueberdb_insert_or_update(character varying, text) OWNER TO etherpad;
CREATE FUNCTION public.ueberdb_insert_or_update_jsonb(character varying, jsonb) RETURNS void
LANGUAGE plpgsql
AS $_$ BEGIN IF EXISTS( SELECT * FROM store WHERE key = $1 ) THEN UPDATE store SET value = $2 WHERE key = $1; ELSE INSERT INTO store(key,value) VALUES( $1, $2 ); END IF; RETURN; END; $_$;
ALTER FUNCTION public.ueberdb_insert_or_update_jsonb(character varying, jsonb) OWNER TO etherpad;
SET default_tablespace = '';
SET default_with_oids = false;
CREATE TABLE public.store (
key character varying(100) NOT NULL,
value jsonb NOT NULL
);
ALTER TABLE public.store OWNER TO etherpad;
ALTER TABLE ONLY public.store
ADD CONSTRAINT store_pkey PRIMARY KEY (key);
我走了回滚路。 我试图将etherpad仅回滚到1.8.4,但没有成功:
[2020-09-11 20:55:44.494] [ERROR] console - JSON-PROBLEM:[object Object]
[2020-09-11 20:55:44.495] [ERROR] console - (node:1) UnhandledPromiseRejectionWarning: SyntaxError: Unexpected token o in JSON at position 1
at JSON.parse (<anonymous>)
at /opt/etherpad-lite/src/node_modules/ueberdb2/CacheAndBufferLayer.js:169:24
at Query.<anonymous> (/opt/etherpad-lite/src/node_modules/ueberdb2/postgres_common.js:99:5)
at Query.handleReadyForQuery (/opt/etherpad-lite/src/node_modules/pg/lib/query.js:128:10)
at Connection.<anonymous> (/opt/etherpad-lite/src/node_modules/pg/lib/client.js:247:19)
at Connection.emit (events.js:198:13)
at Connection.EventEmitter.emit (domain.js:448:20)
at Socket.<anonymous> (/opt/etherpad-lite/src/node_modules/pg/lib/connection.js:134:12)
at Socket.emit (events.js:198:13)
at Socket.EventEmitter.emit (domain.js:448:20)
[2020-09-11 20:55:44.496] [ERROR] console - (node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
[2020-09-11 20:55:44.496] [ERROR] console - (node:1) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
因此,我也恢复了一个pgsql转储,现在1.8.4又可以工作了(这并不奇怪,因为它运行良好)。
原因:列值从1.8.4更改为1.8.5,从text类型更改为jsonb。
应该是主要版本...
是否有可以应用的迁移脚本?
我只是要还原这些提交。 恕我直言,这一切处理不善。
更改日志显示1.8.6的“重要信息:这解决了1.8.5中的Postgresql严重问题”,但我已经升级,仍然得到上面提到的异常。 我现在也注意到了这些异常,它们在服务重启后立即输出:
[2020-09-19 17:47:45.482] [ERROR] console - JSON-PROBLEM:[object Object]
[2020-09-19 17:47:45.496] [ERROR] console - (node:30613) UnhandledPromiseRejectionWarning: SyntaxError: Unexpected token o in JSON at position 1
at JSON.parse (<anonymous>)
at /usr/local/var/etherpad/repo/src/node_modules/ueberdb2/lib/CacheAndBufferLayer.js:169:24
at Query.<anonymous> (/usr/local/var/etherpad/repo/src/node_modules/ueberdb2/databases/postgres_common.js:99:5)
at Query.handleReadyForQuery (/usr/local/var/etherpad/repo/src/node_modules/pg/lib/query.js:122:12)
at Client._handleReadyForQuery (/usr/local/var/etherpad/repo/src/node_modules/pg/lib/client.js:281:19)
at Connection.emit (events.js:315:20)
at Connection.EventEmitter.emit (domain.js:483:12)
at /usr/local/var/etherpad/repo/src/node_modules/pg/lib/connection.js:109:12
at Parser.parse (/usr/local/var/etherpad/repo/src/node_modules/pg-protocol/dist/parser.js:40:17)
at Socket.<anonymous> (/usr/local/var/etherpad/repo/src/node_modules/pg-protocol/dist/index.js:8:42)
[2020-09-19 17:47:45.497] [ERROR] console - (node:30613) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
[2020-09-19 17:47:45.497] [ERROR] console - (node:30613) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
@ c7hm4r您的数据库更改了吗? 如果您开始一个新的Tarble /数据库,那还好吗?
@JohnMcLear在使用空数据库重新启动Etherpad 1.8.6时,将创建一个新架构,它似乎可以正常工作。
当我将新架构与旧架构进行比较时,我得到以下信息:
diff --git a/etherpad_schema.sql b/etherpad_schema_new.sql
index 9baf5f4..ad3c08b 100644
--- a/etherpad_schema.sql
+++ b/etherpad_schema_new.sql
@@ -41,17 +41,6 @@ CREATE FUNCTION public.ueberdb_insert_or_update(character varying, text) RETURNS
ALTER FUNCTION public.ueberdb_insert_or_update(character varying, text) OWNER TO etherpad;
---
--- Name: ueberdb_insert_or_update_jsonb(character varying, jsonb); Type: FUNCTION; Schema: public; Owner: etherpad
---
-
-CREATE FUNCTION public.ueberdb_insert_or_update_jsonb(character varying, jsonb) RETURNS void
- LANGUAGE plpgsql
- AS $_$ BEGIN IF EXISTS( SELECT * FROM store WHERE key = $1 ) THEN UPDATE store SET value = $2 WHERE key = $1; ELSE INSERT INTO store(key,value) VALUES( $1, $2 ); END IF; RETURN; END; $_$;
-
-
-ALTER FUNCTION public.ueberdb_insert_or_update_jsonb(character varying, jsonb) OWNER TO etherpad;
-
SET default_tablespace = '';
SET default_with_oids = false;
@@ -62,7 +51,7 @@ SET default_with_oids = false;
CREATE TABLE public.store (
key character varying(100) NOT NULL,
- value jsonb NOT NULL
+ value text NOT NULL
);
因此,问题是:当列的类型发生更改时,该如何迁移/还原?
我从master分支为Etherpad实例配置了自动更新。
@ c7hm4r @qsuscs是令人讨厌的提交的作者。 我希望他在这里承担一些责任并提供帮助:)
https://github.com/ether/ueberDB/commit/b9e786e2c8753f4cbbe09d3695a92a1a03904ead#diff -f1b8245dd259fa912c33cb2db527f609R31是alter语句。
var updateValueColumnType = "ALTER TABLE store " +
"ALTER COLUMN value " +
"TYPE jsonb " +
"USING value::jsonb";
有人会假设将jsonb更改为文本会做到吗?
感谢@JohnMcLear ,运行以下命令使其再次运行:
alter table "store" alter column "value" type text;
@ c7hm4r不用担心,希望受影响的少数人会找到该线程并执行该命令。,感谢您的编写和测试! :)如果您或原始作者想要,我愿意接受PR进行修复。 目前,我还有其他优先事项。
最有用的评论
感谢@JohnMcLear ,运行以下命令使其再次运行: