0
當插入到字符串和日期唯一約束的PostgreSQL數據庫中時,字符串部分的精確匹配未被使用。如下所示,當我嘗試將'AA','2010-01-04'組合插入到數據庫中時,我得到A,2010-01-04已存在的重複衝突。PostgreSQL的唯一約束不使用完全匹配
INSERT INTO orats_opt
(ticker,dates,stockpx,iv30,iv60,iv90,m1atmiv,m1dtex,m2atmiv,m2dtex,m3atmiv,m3dtex,m4atmiv,m4dtex,slope,deriv,slope_inf,deriv_inf,dclsHV10,dclsHV20,dclsHV60,dclsHV120,dclsHV252,dORHV10,dORHV20,dORHV60,dORHV120,dORHV252)
VALUES ('AA','2010-01-04
+00'::date,16.63,47.68,43.25,43.16,52.34,12.0,43.28,47.0,43.15,103.0,43.08,194.0,2.28,0.03878,2.323,0.05939,45.21,47.01,45.15,47.52,71.41,41.94,49.32,44.63,47.31,60.38)
ERROR: duplicate key value violates unique constraint "unique_ticker_date" DETAIL: Key (ticker, dates)=(A, 2010-01-04) already exists. ********** Error ********** ERROR: duplicate key value violates unique constraint "unique_ticker_date" SQL state: 23505 Detail: Key (ticker, dates)=(A, 2010-01-04) already exists.
請** [編輯] **你的問題,並添加完整'創建table'爲'orats_opt'和相應的唯一約束(或指數)語句。 ** [編輯] **你的問題。請不要**在註釋 –
表中添加代碼或附加信息,最好從psqls'\ d + orats_opt' –
或許'ticker'被定義爲'char(1)'。 –