could not determine data type of parameter $1

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
alfrye
Posts: 16
Joined: Wed 05 May 2010 19:39

could not determine data type of parameter $1

Post by alfrye » Wed 23 Jun 2010 20:19

I am using dotconnect for postgresql and I am trying to use LINQ to call the the Postgresql funciton pg_column_size to determine the size my string is going to take up on the database.

Here is a sampel of the code I am using

Code: Select all

    IEnumerable mysize = context.ExecuteQuery("select pg_column_size({0});","test");
              foreach (var item in mysize)
                  {
                  contentSize = item;
                  }
             
              }

  

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Mon 05 Jul 2010 10:55

Thank you for the report, I have reproduced the error.
I will let you know about the results of our investigation as soon as possible.

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Wed 21 Jul 2010 12:12

Unfortunately, we are unable to perform such a call in LINQ to PostgreSQL.
Please note that this code cannot be called using teh following ADO.NET sample code as well:

Code: Select all

    PgSqlConnection conn = new PgSqlConnection("uid=*;pwd=*;host=andreyr;database=testdb");
      conn.Open();
      PgSqlCommand cmd = new PgSqlCommand("select pg_column_size(:p0);", conn);
      cmd.Parameters.Add("p0", "test");
      using (PgSqlDataReader rdr = cmd.ExecuteReader()) {
        while (rdr.Read()) {
          int i = rdr.GetInt32(0);
        }
The problem is associated with the fact that the type of parameter in this case is "any" in PostgreSQL, and cannot be determined correctly.

Post Reply