title: npgsql, arrays and C# the operator does not exist: text[] = text
body: <p>. I would really appreciate if somebody could help me out to fix this problem</p>
  
  <p>I'm developing an application using npgsql and c# and when i want to retrieve some information from a table which contains a column with an array of elements, the problem starts when I want to use a query like this:</p>
  
  <pre><code>   NpgsqlCommand cmd = new NpgsqlCommand("select * from book_editions", conn);
  </code></pre>
  
  <p>the compiler shows the column which contains the elements example({1st,2nd,3d}) as "Data.System.String[] therefore i tried to fix the problem by using parameters....
  like is shown here below.</p>
  
  <pre><code>    NpgsqlConnection conn = new NpgsqlConnection("Server=127.0.0.1;User Id=postgres; " +"Password=admin;Database=library_system;");
      conn.Open();
  
      //////string[] options = new string[] { "marketing", "m" }; already tried and failed
  
      ArrayList l = new ArrayList();
          l.Add("2th");
          l.Add("3th");
  
          NpgsqlParameter p = new NpgsqlParameter("parameterlist", NpgsqlTypes.NpgsqlDbType.Array | NpgsqlTypes.NpgsqlDbType.Text);
  
          NpgsqlCommand cmd = new NpgsqlCommand("select * from book_editions where editions = any (:parameterlist)", conn);
  
          //editions is the column which has the array of elements, its datatype is text
  
          p.Value = l.ToArray();
          cmd.Parameters.Add(p);
  
       NpgsqlDataReader dr = cmd.ExecuteReader();
  
       while (dr.Read())
  
       Console.Write("{0} \n", dr[0].ToString());
  
       Console.ReadKey();
  
        conn.Close();
  </code></pre>
  
  <p>when i execute the code the <code>cmd.ExecuteReader</code> throws this error:</p>
  
  <pre><code>npgsql was unhandled
  ERROR: 42883: el operador no existe: text[] = text
  </code></pre>
  
  <p>i got the following sentence as a tip....</p>
  
  <blockquote>
    <p>Ningún operador coincide con el nombre y el tipo de los argumentos.
    Puede ser necesario agregar conversiones explícitas de tipos. (there
    is no operator which matches with the name and argument types, it
    would be required to add explicit type castings</p>
  </blockquote>
  
  <p>does anybody know the solution? :( :( i already tried hard.</p>