且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将数组插入PostgreSQL

更新时间:2023-12-04 15:38:31

您没有任何具有 ARRAY dataType的字段,因此从本质上讲您不能将数组插入该字段。如果您希望将数组放入字段中,请先将其数据类型更改为 ARRAY ,然后可以

You dont have any field with ARRAY dataType so essentially you cannot insert array into the field. If you wish to put in array in a field change its data type to ARRAY first and then you can

INSERT INTO "some_table" ("id","array_field","some_text_field") 
VALUES (1,ARRAY['value1','value2']::TEXT[],'active') RETURNING *

希望这会有所帮助。让我知道我能否进一步帮助

Hope this helps. Let me know if i can help further