我怎样才能插入一个array of enums
?
这是我的enum
:
CREATE TYPE equipment AS ENUM ('projector','PAsystem','safe','PC','phone');
然后我的桌子上有一系列设备:
CREATE TABLE lecture_room (
id INTEGER DEFAULT NEXTVAL('lecture_id_seq')
, seatCount int
, equipment equipment[]
) INHERITS(venue);
这是我插入的尝试:
INSERT INTO lecture_room (building_code, floorNo, roomNo, length, width
, seatCount, equipment)
VALUES
('IT', 4, 2, 10, 15 ,120, ARRAY['projector','PAsystem','safe']),
但它给了我以下错误:
ERROR: column "equipment" is of type equipment[] but expression is of type text[] SQL state: 42804 Hint: You will need to rewrite or cast the expression.