简体   繁体   English

Postgresql 列存在,但获取关系列不存在

[英]Postgresql column exists, but getting column of relation does not exist

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

I have a table called messages which has column called replyDate.我有一个名为messages 的表,其中有一个名为replyDate 的列。 The event.state.session.lastMessages contains a list of javascript object like so: [ { eventId: '14337275205243615', incomingPreview: 'bonjour', replyConfidence: 1, replySource: 'dialogManager', replyDate: '2021-05-04T16:40:07.242Z', replyPreview: '#!builtin_single-choice-mrFFU_' } ] The event.state.session.lastMessages contains a list of javascript object like so: [ { eventId: '14337275205243615', incomingPreview: 'bonjour', replyConfidence: 1, replySource: 'dialogManager', replyDate: '2021-05-04T16:40:07.242Z', replyPreview: '#!builtin_single-choice-mrFFU_' } ]

I want to save in my DB the values replyDate, but i get the error:我想在我的数据库中保存值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

If you have table names with upper case you have to enclose the table with double quotes如果您有大写的表名,则必须用双引号将表括起来

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')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM