koishijs / koishi

Cross-platform chatbot framework made with love
https://koishi.chat
MIT License
4.54k stars 249 forks source link

Bug: Postgresql使用报错 #1279

Closed yunkuangao closed 1 year ago

yunkuangao commented 1 year ago

Describe the bug

postgresql插件报错

Steps to reproduce

需要一个matrix服务端和一个postgresql数据库

Expected behavior

postgresql插件正常工作

Screenshots

postgresql插件有语法错误

2023-11-22 15:05:02 [I] loader apply plugin database-postgres:5rbksd
2023-11-22 15:05:02 [W] app PostgresError: syntax error at or near "DEFAULT"
                            at ErrorResponse (/koishi/node_modules/postgres/cjs/src/connection.js:790:26)
                            at handle (/koishi/node_modules/postgres/cjs/src/connection.js:476:6)
                            at Socket.data (/koishi/node_modules/postgres/cjs/src/connection.js:315:9)
                            at Socket.emit (node:events:514:28)
                            at addChunk (node:internal/streams/readable:324:12)
                            at readableAddChunk (node:internal/streams/readable:297:9)
                            at Readable.push (node:internal/streams/readable:234:10)
                            at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
                            at new Query (/koishi/node_modules/postgres/cjs/src/query.js:35:9)
                            at _PostgresDriver.sql (/koishi/node_modules/postgres/cjs/src/index.js:112:11)
                            at _PostgresDriver.prepare (/koishi/node_modules/@minatojs/driver-postgres/lib/index.js:442:21)
                            at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
                            at async Proxy.prepare (/koishi/node_modules/@minatojs/core/lib/index.cjs:576:5)
2023-11-22 15:05:02 [W] app PostgresError: syntax error at or near "DEFAULT"
                            at ErrorResponse (/koishi/node_modules/postgres/cjs/src/connection.js:790:26)
                            at handle (/koishi/node_modules/postgres/cjs/src/connection.js:476:6)
                            at Socket.data (/koishi/node_modules/postgres/cjs/src/connection.js:315:9)
                            at Socket.emit (node:events:514:28)
                            at addChunk (node:internal/streams/readable:324:12)
                            at readableAddChunk (node:internal/streams/readable:297:9)
                            at Readable.push (node:internal/streams/readable:234:10)
                            at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
                            at new Query (/koishi/node_modules/postgres/cjs/src/query.js:35:9)
                            at _PostgresDriver.sql (/koishi/node_modules/postgres/cjs/src/index.js:112:11)
                            at _PostgresDriver.prepare (/koishi/node_modules/@minatojs/driver-postgres/lib/index.js:442:21)
                            at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
                            at async Proxy.prepare (/koishi/node_modules/@minatojs/core/lib/index.cjs:576:5)
2023-11-22 15:05:02 [W] postgres > SELECT 'group' AS name,
                                  pg_total_relation_size('group') AS size,
                                  COUNT(*) AS count FROM group UNION SELECT 'stats_hourly' AS name,
                                  pg_total_relation_size('stats_hourly') AS size,
                                  COUNT(*) AS count FROM stats_hourly UNION SELECT 'perm_track' AS name,
                                  pg_total_relation_size('perm_track') AS size,
                                  COUNT(*) AS count FROM perm_track UNION SELECT 'stats_longterm' AS name,
                                  pg_total_relation_size('stats_longterm') AS size,
                                  COUNT(*) AS count FROM stats_longterm UNION SELECT 'stats_daily' AS name,
                                  pg_total_relation_size('stats_daily') AS size,
                                  COUNT(*) AS count FROM stats_daily
2023-11-22 15:05:02 [W] app PostgresError: syntax error at or near "group"
                            at ErrorResponse (/koishi/node_modules/postgres/cjs/src/connection.js:790:26)
                            at handle (/koishi/node_modules/postgres/cjs/src/connection.js:476:6)
                            at Socket.data (/koishi/node_modules/postgres/cjs/src/connection.js:315:9)
                            at Socket.emit (node:events:514:28)
                            at addChunk (node:internal/streams/readable:324:12)
                            at readableAddChunk (node:internal/streams/readable:297:9)
                            at Readable.push (node:internal/streams/readable:234:10)
                            at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
                            at new Query (/koishi/node_modules/postgres/cjs/src/query.js:35:9)
                            at Function.unsafe (/koishi/node_modules/postgres/cjs/src/index.js:121:21)
                            at _PostgresDriver.query (/koishi/node_modules/@minatojs/driver-postgres/lib/index.js:407:27)
                            at _PostgresDriver.stats (/koishi/node_modules/@minatojs/driver-postgres/lib/index.js:494:35)
                            at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
                            at async /koishi/node_modules/@minatojs/core/lib/index.cjs:662:36
                            at async Promise.all (index 0)
                            at async Proxy.stats (/koishi/node_modules/@minatojs/core/lib/index.cjs:661:5)
                            at async _DatabaseProvider.getInfo (/koishi/node_modules/koishi-plugin-dataview/lib/index.cjs:108:19)
                            at async _DatabaseProvider.refresh (/koishi/node_modules/@koishijs/console/lib/index.js:56:14)

在运行时(matrix)也有错误:

2023-11-22 15:06:26 [W] session <image url="https://im.yka.moe/_matrix/_matrix/media/v3/download/im.yka.moe/******"/>
                        Error: unsupported type: unsigned
                            at getTypeDef (/koishi/node_modules/@minatojs/driver-postgres/lib/index.js:84:15)
                            at /koishi/node_modules/@minatojs/driver-postgres/lib/index.js:430:15
                            at Array.forEach (<anonymous>)
                            at _PostgresDriver.prepare (/koishi/node_modules/@minatojs/driver-postgres/lib/index.js:423:28)
                            at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
                            at async Proxy.prepare (/koishi/node_modules/@minatojs/core/lib/index.cjs:576:5)
                            at async _DatabaseService.prepare (/koishi/node_modules/@minatojs/core/lib/index.cjs:572:5)
                            at async Proxy.prepare (/koishi/node_modules/@minatojs/core/lib/index.cjs:572:5)
                            at async Proxy.prepare (/koishi/node_modules/@minatojs/core/lib/index.cjs:572:5)

Versions

Additional context

No response

shigma commented 1 year ago

cc @Hieuzest

Hieuzest commented 1 year ago

请问postgresql数据库版本? cc @Seidko

yunkuangao commented 1 year ago

使用该镜像 https://docker.yka.moe/#!/1/docker/images/postgres:15