0
私は整数型の列box_coordinates [4]を持っています。配列の各要素を640で除算し、float型の新しい列に挿入します]。私が最初にPostgreSQLのarray型の列の各要素に除算を適用します
SELECT n/640::float
FROM (
SELECT unnest(box_coordinates)
FROM images
) AS n;
を集約する前に、配列の各要素を分割しようとするが、それはエラーで失敗した私は、配列の要素分割を適用し、型の新しい列に結果を挿入するにはどうすればよい
ERROR: operator does not exist: record/integer
HINT: No operator matches the given name and argument type(s).
You might need to add explicit type casts.
float [4]、新しい配列の要素の順序は変更しません。
感謝を
n
を使用している、それは働きます!投稿を編集してfloat [4]型の新しい列に挿入する方法に答えることができますか? – Kostasあなたは 'array_agg()'が必要です。http://stackoverflow.com/questions/6402043/store-select-querys-output-in-one-array-in-postgres –