PostgreSQL Function: Invalid Datatype: double

PostgreSQL Function: Invalid Datatype: double

Postby ChrisMH » Thu 17 Mar 2011 18:26

I've got a PostgreSQL plpgsql function that I'm having trouble calling with LINQ to SQL. The actual function is more complex than the attached, but I've reproduced the same problem with the simple test here.

Latest version of LinqConnect downloaded yesterday.

What am I doing wrong?


Stack Trace:

Code: Select all
System.InvalidOperationException: Invalid datatype: double
  at Devart.Data.PostgreSql.Linq.Provider.a.a(String A_0, Boolean A_1)
  at Devart.Data.PostgreSql.Linq.Provider.b.a.a(String A_0)
  at Devart.Data.Linq.Provider.Query.v.a(MethodCallExpression A_0, MetaFunction A_1)
  at Devart.Data.Linq.Provider.Query.v.a(MethodCallExpression A_0)
  at Devart.Data.Linq.Provider.Query.v.b(MethodCallExpression A_0)
  at Devart.Data.Linq.Provider.Query.v.j(Expression A_0)
  at Devart.Data.Linq.Provider.Query.v.i(Expression A_0)
  at Devart.Data.Linq.Provider.DataProvider.BuildQuery(Expression query)
  at Devart.Data.Linq.Provider.DataProvider.Devart.Data.Linq.Provider.IProvider.Execute(Expression query)
  at Devart.Data.Linq.DataContext.ExecuteMethodCall(Object instance, MethodInfo methodInfo, Object[] parameters)
  at Db.DbDataContext.MainTestFunction(Nullable`1 DParam) in d:\devl\restoration-postgresql\source\utility\sqlservertopostgresql\sqlservertopostgresql\datacon
text.designer.cs:line 249
  at SQLServerToPostgreSQL.MainWindow.CtlTransfer_Click(Object sender, RoutedEventArgs e) in D:\DevL\Restoration-PostgreSQL\Source\Utility\SQLServerToPostgreSQL\SQLServerToPostgreSQL\MainWindow.xaml.cs:line 48



plpgsql function:

Code: Select all
CREATE OR REPLACE FUNCTION main.test_function(d_param double precision)
  RETURNS void AS
$BODY$
DECLARE

BEGIN
  RAISE LOG 'dParam=%', d_param;

  RETURN;
END;
$BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100;


Generated by EntityDeveloper:

Code: Select all
        ///
        /// There are no comments for MainTestFunction in the schema.
        ///

        [Function(Name=@"main.test_function")]
        public System.Int32 MainTestFunction([Parameter(Name="d_param", DbType="double precision")] System.Nullable DParam)
        {
            IExecuteResult _MainTestFunctionResult = this.ExecuteMethodCall(this, ((MethodInfo)(MethodInfo.GetCurrentMethod())), DParam);
            return ((System.Int32)(_MainTestFunctionResult.ReturnValue));
        }



My client code:

Code: Select all
      try {
        Db.DbDataContext dc = new Db.DbDataContext();
        dc.MainTestFunction( 1.0 );       
      }
      catch( Exception ex ) {

        Log.LogItem( ex );
      }

ChrisMH
 
Posts: 14
Joined: Tue 15 Mar 2011 18:11

Postby StanislavK » Fri 18 Mar 2011 14:14

Thank you for your report, we've reproduced this error. We will post here when it is fixed.

As a temporary workaround, you can change the 'DbType' property of this parameter, e.g., to 'Numeric' (Model Explorer -> Methods -> 'TestFunction' -> Parameters). Please tell us if this helps.
StanislavK
Devart Team
 
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Postby ChrisMH » Fri 18 Mar 2011 15:14

Yes, that works.

Is this an issue that will be fixed in the near future? I'd prefer not to have to remember to go change those types every time I update the mode.

Thanks
ChrisMH
 
Posts: 14
Joined: Tue 15 Mar 2011 18:11

Postby StanislavK » Mon 21 Mar 2011 13:57

We have fixed this issue. The fix will be available in the nearest build, which we plan to release in several days. We will post here when this build is available.
StanislavK
Devart Team
 
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Postby ChrisMH » Thu 24 Mar 2011 14:35

Fixed in 2.20.17

Thanks!
ChrisMH
 
Posts: 14
Joined: Tue 15 Mar 2011 18:11


Return to LinqConnect (LINQ to SQL support)