'Invalid parameter specified' on prepared query with a double

'Invalid parameter specified' on prepared query with a double

In our project we get an Exception: 'Invalid parameters specified'. We've determined that this is specifically when we use a double variable.

In the scenarios below the first two instances of TPgQuery are executing properly, however on opening the third query, we get the the error.

  1. procedure TMyForm.OkButtonClick(Sender: TObject);
    var
      objQuery: TPgQuery;
      dblValue: Double;
    begin
      objQuery := TPgQuery.Create(nil);
      try
        objQuery.Connection := DATACON;
        objQuery.SQL.Text := 'SELECT :dblValue';
        objQuery.ParamByName('dblValue').Value := 13.37;
        objQuery.Open();  // OK
      finally
        objQuery.Free;
      end;

      DATACON.ExecSQL('PREPARE PreparedQuery(double precision) AS SELECT $1');

      objQuery := TPgQuery.Create(nil);
      try
        objQuery.Connection := DATACON;
        objQuery.SQL.Text := 'EXECUTE PreparedQuery(:dblValue)';
        objQuery.ParamByName('dblValue').Value := 1.23;
        objQuery.Open();  // OK
      finally
        objQuery.Free;
      end;

      dblValue := 1.23;
      objQuery := TPgQuery.Create(nil);
      try
        objQuery.Connection := DATACON;
        objQuery.SQL.Text := 'EXECUTE PreparedQuery(:dblValue)';
        objQuery.ParamByName('dblValue').Value := dblValue;
        objQuery.Open();  // Returns error
      finally
        objQuery.Free;
      end;
    end;
This test scenario is independent of the database used. We also tried setting the DataType property to ftFloat, this does not make a difference.

We use PgDac Professional Edition 7.4.0 using RAD Studio 11.2.
We've previously used PgDac 7.2.1 on RAD Studio 11 and this does not return any error with these scenarios.