[pgsql-jp: 41706] PostgresqlとNpgsqlとのデータ型対応について
oira3ryu
oira3ryu @ sea.plala.or.jp
2014年 8月 20日 (水) 17:17:56 JST
こんにちは、味噌と申します。
Postgresql 9.3.4 と Npgsql 2.0.14.3 でVisual Studio 2010 を使い
WindowsFormアプリケーションを作成しています。
Postgresql のテーブルAにtext[] 型の配列を格納しております
構成はこのようなもので
テーブルA
id serial not null
c4_array text[]
中身はこのような状態のものに
id | c4_array
------------------
1,{H26," 7"}
試にデータアダプタで更新をかけようとしたのですが
da.UpdateCommand = new NpgsqlCommand(
"update テーブルA set"
+ " c4_array = :c4_array"
+ " where id=:id;"
, m_conn
);
da.UpdateCommand.Parameters.Add(new NpgsqlParameter("c4_array", NpgsqlTypes.NpgsqlDbType.Text, 0, "c4_array", ParameterDirection.Input, false, 0, 0, DataRowVersion.Current, DBNull.Value));
NpgsqlTypes.NpgsqlDbTypeの部分で
「column A is of type text[] expression but is of type text.」とエラーになってしまいます。
text[]型とtext型なのでエラーになるのはわかりますが
このような場合、NpgsqlTypes.NpgsqlDbTypeでどの型が対応するのでしょうか?
http://www.postgresql.jp/document/NPGSQL/manual/UserManual_J.htm を参照してみましたが
対応する型が見つけられませんでした。
どなたかご指導よろしくお願いします。
pgsql-jp メーリングリストの案内