2
我是新來的python,我想在pl/python(爲了達到更快的處理)做一些服務器編程,並且在我決定資源化此列表尋找幫助。傳遞一個真正的[]作爲參數之間的plpython函數
我想傳遞一個vessel_speed創建的類型
CREATE TYPE vessel_speed AS (
mmsi integer,
sog real[]
);
CREATE OR REPLACE FUNCTION dummy(c_vessel vessel_speed)
RETURNS real[]
AS $$
return c_vessel["sog"]
$$ LANGUAGE plpython3u;
我試圖調用以這種方式從另一個PL/Python的虛擬功能,從另一個調用一個PL/Python函數:
st = "SELECT dummy(($1,ARRAY[$2])::vessel_speed)"
pst = plpy.prepare(st, ["integer", "real[]"])
rv = plpy.execute(pst, [112, (1.2,3.1)])
返回一個錯誤:
ERROR: spiexceptions.FeatureNotSupported: cannot convert multidimensional array to Python list
Estado SQL:0A000
Detalle:PL/Python only supports one-dimensional arrays.
任何人知道如何解決這個......或任何人?解決方案?非常感謝, 胡安