我想對下表執行插入操作,但我無法將日期轉換爲ARRAY。如何在Postgres中對日期進行排列
CREATE TABLE schedule (
idschedule serial NOT NULL,
idzone integer NOT NULL,
"time" timestamp without time zone NOT NULL,
automatic boolean NOT NULL,
idrecurrence character varying(20),
duration integer,
date date,
)
的INSERT
我試圖執行:
INSERT INTO schedule(idzone, "date", "time", duration, automatic)
SELECT x, y, '20:00:00' id, '20', 'FALSE'
FROM unnest(ARRAY[3,4,5]) x, unnest(ARRAY[ 2015-4-12, 2015-4-19, 2015-4-26]) y
我得到以下錯誤:
ERROR: Column 'date' is of type date But the expression is of type integer
什麼是您的Postgres版本?什麼是''20:00:00'ID'應該這樣做?你真的想要一個笛卡兒積(3 x 3 = 9行),還是你真的想要兩個數組並行取得3行? –