我遵循的是Aqueduct(Dart的Web服务框架)教程(https://aqueduct.io/docs/tut/executing-queries/),然后当我尝试运行此命令时

aqueduct db upgrade --connect postgres://heroes_user:password@localhost:5432/heroes

我有一个错误:
PostgreSQL connecting, heroes_user@localhost:5432/heroes.
*** Uncaught error
    Bad state: PostgreSQLSeverity.error : Specified parameter types do not match column parameter types in query SELECT to_regclass(@tableName:text)
  **** Stacktrace
  * #0      __TransactionProxy&Object&_PostgreSQLExecutionContextMixin._enqueue (package:postgres/src/connection.dart:400:24)
  * <asynchronous suspension>
  * #1      __TransactionProxy&Object&_PostgreSQLExecutionContextMixin.query (package:postgres/src/connection.dart:316:12)
  * <asynchronous suspension>
  * #2      PostgreSQLPersistentStore._createVersionTableIfNecessary (package:aqueduct/src/db/postgresql/postgresql_persistent_store.dart:335:34)
  * <asynchronous suspension>
  * #3      PostgreSQLPersistentStore.upgrade.<anonymous closure> (package:aqueduct/src/db/postgresql/postgresql_persistent_store.dart:231:13)
  * <asynchronous suspension>
  * #4      _TransactionProxy.startTransaction (file:///home/gabriel/.pub-cache/hosted/pub.dartlang.org/postgres-1.0.0/lib/src/transaction_proxy.dart:36:22)
  * <asynchronous suspension>
  * #5      _RootZone.runUnary (dart:async/zone.dart:1379:54)
  * #6      _FutureListener.handleValue (dart:async/future_impl.dart:129:18)
  * #7      Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:642:45)
  * #8      Future._propagateToListeners (dart:async/future_impl.dart:671:32)
  * #9      Future._propagateToListeners (dart:async/future_impl.dart:569:9)
  * #10     Future._complete (dart:async/future_impl.dart:476:7)
  * #11     _SyncCompleter.complete (dart:async/future_impl.dart:51:12)
  * #12     Query.complete (package:postgres/src/query.dart:140:19)
  * #13     _PostgreSQLConnectionStateBusy.onMessage (file:///home/gabriel/.pub-cache/hosted/pub.dartlang.org/postgres-1.0.0/lib/src/connection_fsm.dart:246:15)
  * #14     PostgreSQLConnection._readData (package:postgres/src/connection.dart:230:47)
  * #15     _RootZone.runUnaryGuarded (dart:async/zone.dart:1314:10)
  * #16     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
  * #17     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
  * #18     _SyncStreamController._sendData (dart:async/stream_controller.dart:763:19)
  * #19     _StreamController._add (dart:async/stream_controller.dart:639:7)
  * #20     _StreamController.add (dart:async/stream_controller.dart:585:5)
  * #21     _Socket._onData (dart:io/runtime/binsocket_patch.dart:1714:41)
  * #22     _RootZone.runUnaryGuarded (dart:async/zone.dart:1314:10)
  * #23     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
  * #24     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
  * #25     _SyncStreamController._sendData (dart:async/stream_controller.dart:763:19)
  * #26     _StreamController._add (dart:async/stream_controller.dart:639:7)
  * #27     _StreamController.add (dart:async/stream_controller.dart:585:5)
  * #28     new _RawSocket.<anonymous closure> (dart:io/runtime/binsocket_patch.dart:1276:33)
  * #29     _NativeSocket.issueReadEvent.issue (dart:io/runtime/binsocket_patch.dart:819:14)
  * #30     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
  * #31     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
  * #32     _runPendingImmediateCallback (dart:isolate/runtime/libisolate_patch.dart:113:13)
  * #33     _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:166:5)

我不明白发生了什么事,有人可以帮我吗?
谢谢。

最佳答案

如果您运行的是Postgresql 9.5或更早版本,则会收到此错误。升级到9.6。

Aqueduct保留一个表来跟踪您的数据库迁移历史记录和当前版本。它使用pg9.6中引入的函数来检查该表是否存在。

关于database - 错误状态:PostgreSQLSeverity.error:指定的参数类型与查询SELECT to_regclass(@tableName:text)中的列参数类型不匹配,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/52174665/

10-10 13:09