{ scientistSeedError: 'syntax error at or near "["' }

{ scientistSeedError: 'syntax error at or near "["' }

我正在尝试通过我创建的种子文件将一些数据添加到 postgresql 中的 table。所有路线都有效,我已经创建了另一个 table。但是,在这个特定的 table 上,我试图在其中一列中添加一个数组,但我一直收到此错误。有谁知道它可能是什么?或者我如何通知 postgresql table 我想添加一些数组:

```{ scientistSeedError: 'syntax error at or near "["' }````

下面是创建 table

的查询
    const query = 
CREATE TABLE "scientist" (
    "id" serial NOT NULL,
    "first_name" varchar(255) NOT NULL,
    "last_name" varchar(255) NOT NULL,
    "area_expertise" varchar(255) NOT NULL,
    "areaExpertise" TEXT ARRAY NOT NULL,
    "field" TEXT ARRAY NOT NULL,
    "wiki_link" varchar(255) NOT NULL,
    "picture" varchar(255) NOT NULL,
    "short_description" varchar(400),
    CONSTRAINT "scientist_pk" PRIMARY KEY ("id")
) WITH (
  OIDS=FALSE
);`
;
try {
    await db.query(query);
    res.send("Database successfully created");
} catch(e){
    console.log(e.message)
}

};```

 **and below a fragment of the query to add the data. As is too large to post here but** 

```module.exports.seedPart2 = async (req, res, next) => {
     // Scientist query
    const scientistsQuery = `
      INSERT INTO scientist (first_name, 
        last_name,
        area_expertise,
        field,
        issue_tackled,
        wiki_link,
        picture) VALUES
      ('Eugenie', 'Clark', 'Ichthyologist', 'biology', 'Environmental preservation', 'https://en.wikipedia.org/wiki/Eugenie_Clark', 'http://www.alertdiver.com/cdn/13649.jpg'),
      ('Susan', 'Solomon',  'Atmospheric Chemist',  'Chemistry',    ['Environmental preservation', 'Chemistry'],    'https://en.wikipedia.org/wiki/Susan_Solomon' , 'https://upload.wikimedia.org/wikipedia/commons/thumb/8/80/Susan_Solomon-Desk_With_Globe.jpg/1024px-Susan_Solomon-Desk_With_Globe.jpg'),
      ('Donna Theo',    'Strickland',    'Physics, Optics, and Lasers', 'Physics', ['Medicine', 'New technologies'],    'https://en.wikipedia.org/wiki/Donna_Strickland',   'https://upload.wikimedia.org/wikipedia/commons/thumb/3/38/Donna_Strickland_EM1B5760_%2846183560632%29_%28cropped%29.jpg/220px-Donna_Strickland_EM1B5760_%2846183560632%29_%28cropped%29.jpg'),
      ('Linda', 'Brown Buck',   'Biologist', 'Biology', 'Medicine', 'https://en.wikipedia.org/wiki/Linda_B._Buck', 'https://upload.wikimedia.org/wikipedia/commons/thumb/2/20/Linda_Buck_2015_%28cropped%29.jpg/200px-Linda_Buck_2015_%28cropped%29.jpg')`;
  
    try {
        const {rows} = await db.query(scientistsQuery);
    res.status(201).json(rows)
    } catch (e) {
      console.log({ scientistSeedError: e.message });
    }
  
  };


感谢您的帮助!!!

PostgreSQL 中的数组文字用大括号表示,而不是方括号(详情请参阅 the documentation):

const scientistsQuery = `
  INSERT INTO scientist (first_name, 
    last_name,
    area_expertise,
    field,
    issue_tackled,
    wiki_link,
    picture) VALUES
  ('Eugenie', 'Clark', 'Ichthyologist', 'biology', 'Environmental preservation', 'https://en.wikipedia.org/wiki/Eugenie_Clark', 'http://www.alertdiver.com/cdn/13649.jpg'),
  ('Susan', 'Solomon',  'Atmospheric Chemist',  'Chemistry',    '{"Environmental preservation", "Chemistry"}',    'https://en.wikipedia.org/wiki/Susan_Solomon' , 'https://upload.wikimedia.org/wikipedia/commons/thumb/8/80/Susan_Solomon-Desk_With_Globe.jpg/1024px-Susan_Solomon-Desk_With_Globe.jpg'),
  ('Donna Theo',    'Strickland',    'Physics, Optics, and Lasers', 'Physics', '{"Medicine", "New technologies"}',    'https://en.wikipedia.org/wiki/Donna_Strickland',   'https://upload.wikimedia.org/wikipedia/commons/thumb/3/38/Donna_Strickland_EM1B5760_%2846183560632%29_%28cropped%29.jpg/220px-Donna_Strickland_EM1B5760_%2846183560632%29_%28cropped%29.jpg'),
  ('Linda', 'Brown Buck',   'Biologist', 'Biology', 'Medicine', 'https://en.wikipedia.org/wiki/Linda_B._Buck', 'https://upload.wikimedia.org/wikipedia/commons/thumb/2/20/Linda_Buck_2015_%28cropped%29.jpg/200px-Linda_Buck_2015_%28cropped%29.jpg')`;