I have a Postgres user table with roles as json
. I am struggling to insert data into it.
Roles looks like this:
[‘角色用户’,‘角色管理员’,‘角色超级管理员’]
我试过几种方法,包括下面的方法,但似乎都不起作用:
INSERT INTO myschema."user" (username, roles)
VALUES ('brk', ARRAY[‘角色用户’,‘角色管理员’,‘角色超级管理员’]::json);
我没有得到一个错误,至少明确地说.
表格定义:
CREATE TABLE myschema."user" (
id SERIAL NOT NULL,
username VARCHAR(180) NOT NULL,
roles JSON NOT NULL,
password VARCHAR(255) NOT NULL,
PRIMARY KEY(id))