PostgreSQL INSERT into an array of enums

前端 未结 4 1861
萌比男神i
萌比男神i 2021-02-13 02:48

How can I insert an array of enums?
Here is my enum:

CREATE TYPE equipment AS ENUM (\'projector\',\'PAsystem\',\'safe\',\'PC\',\'ph         


        
4条回答
  •  渐次进展
    2021-02-13 03:16

    Old question, but a new answer. In modern versions of Postgres (tested with 9.6) none of this is required. It works as expected:

    INSERT INTO lecture_room (equipment) VALUES ('{"projector", "safe"}');
    

提交回复
热议问题