给定一个包含 type 列的表jsonb[],如何将 json 数组插入到该列中?
使用提供的格式化程序在这种情况下:array不起作用:json- 除非我缺少正确的组合或其他东西。
const links = [
{
title: 'IMDB',
url: 'https://www.imdb.com/title/tt0076759'
},
{
title: 'Rotten Tomatoes',
url: 'https://www.rottentomatoes.com/m/star_wars'
}
];
const result = await db.none(`INSERT INTO tests (links) VALUES ($1:json)`, [links]);
Run Code Online (Sandbox Code Playgroud) pg-promise ×1