CREATE TYPE myenum AS ENUM ('title', 'link', 'text');
CREATE TYPE struct AS (
type myenum,
content varchar(300)
);
CREATE TABLE "mytable" (
id serial PRIMARY KEY,
array struct[]
);
INSERT INTO "mytable" VALUES (
DEFAULT,
'{"(\"title\",\"my title\")","(\"link\",\"www.google.com\")"}'
);
INSERT INTO "mytable" VALUES (
DEFAULT,
ARRAY['(\"title\",\"my title\")', '(\"link\",\"www.google.com\")']
);
INSERT INTO "mytable" VALUES (
DEFAULT,
ARRAY[('title','my title'), ('link','www.google.com')]
);
i want to insert some data , and i tried many forms but they all can't insert success, and there are some error messages
error: malformed array literal: "{"("title","my title")","("link","www.google.com")"}"
error: malformed array literal: "{("title","my title"), ("link","www.google.com")}"
error: column "placeholder_array" is of type placeholder_struct[] but expression is of type text[]
error: column "placeholder_array" is of type placeholder_struct[] but expression is of type record[]
need helppppp! that's so hard and messy for me, thank you very much!!!!