0
 query =
      'insert into ' +
      table +
      "( replyDate) values('" +
      event.state.session.lastMessages
        .map(function(elem) {
          return elem.replyDate
        })
        .join(',') +
      "')"

我有一个名为messages 的表,其中有一个名为replyDate 的列。event.state.session.lastMessages 包含一个 javascript 对象列表,如下所示: [ { eventId: '14337275205243615', incomingPreview: 'bonjour', replyConfidence: 1, replySource: 'dialogManager', replyDate: '2021-05-04T16:40:07.242Z', replyPreview: '#!builtin_single-choice-mrFFU_' } ]

我想在我的数据库中保存值replyDate,但我收到错误:

Executing: insert into messages( replyDate) values('2021-05-07T11:33:36.721Z,2021-05-07T11:33:39.704Z,2021-05-07T11:33:42.414Z,2021-05-07T11:33:42.422Z,2021-05-07T11:33:49.454Z')
 error: la colonne « replydate » de la relation « messages » n'existe pas
4

1 回答 1

0

如果您有大写的表名,则必须用双引号将表括起来

insert into messages( "replyDate") values('2021-05-07T11:33:36.721Z'),('2021-05-07T11:33:39.704Z'),('2021-05-07T11:33:42.414Z'),('2021-05-07T11:33:42.422Z'),('2021-05-07T11:33:49.454Z')
于 2021-05-07T15:07:06.257 回答