InvalidOperationException Invalid attempt to read from column ordinal 'n'

Thread is closed for posting
6 posts, 0 answers
  1. Zlatko
    Zlatko avatar
    30 posts
    Member since:
    Sep 2013

    Posted 31 Jan 2017 Link to this post

    Hi Telerik Team,

    I am experiencing difficulties with Open Access when I try to retrieve big data from PostgreSQL database. 

    It seems the Buffer got overloaded and it produces System.InvalidOperationException Invalid attempt to read from column ordinal '23'. With CommandBehavior.SequentialAccess, you may only read from column ordinal '24' or greater.

    Please can you look into this and provide me with a solution?

    See below:

    DB server: PostgreSQL 9.3.15 (could also be 9.4.1)


    Creating test table

    CREATE TABLE audit.test (
      id BIGSERIAL,
      c00 TEXT, c01 TEXT, c02 TEXT, c03 TEXT, c04 TEXT, c05 TEXT, c06 TEXT, c07 TEXT, c08 TEXT, c09 TEXT, c10 TEXT, c11 TEXT, c12 TEXT, c13 TEXT, c14 TEXT, c15 TEXT, c16 TEXT, c17 TEXT, c18 TEXT, c19 TEXT, c20 TEXT,
      c21 TEXT, c22 TEXT, c23 TEXT, c24 TEXT, c25 TEXT, c26 TEXT, c27 TEXT, c28 TEXT, c29 TEXT, c30 TEXT, c31 TEXT, c32 TEXT, c33 TEXT, c34 TEXT, c35 TEXT, c36 TEXT, c37 TEXT, c38 TEXT, c39 TEXT, c40 TEXT,
      c41 TEXT, c42 TEXT, c43 TEXT, c44 TEXT, c45 TEXT, c46 TEXT, c47 TEXT, c48 TEXT, c49 TEXT,
      CONSTRAINT test_pkey PRIMARY KEY(id)

    WITH (oids = false);


    Creating function that creates test data in the test table.

    CREATE OR REPLACE FUNCTION audit.test_f (
    )
    RETURNS void AS
    $body$
    DECLARE
      i integer;
    BEGIN
      FOR i IN 1..1500000
      LOOP
        INSERT INTO audit.test ("c00", "c01", "c02", "c03", "c04", "c05", "c06", "c07", "c08", "c09", "c10", "c11", "c12", "c13", "c14", "c15", "c16", "c17", "c18", "c19", "c20", "c21", "c22", "c23", "c24", "c25", "c26", "c27", "c28", "c29", "c30", "c31", "c32", "c33", "c34", "c35", "c36", "c37", "c38", "c39", "c40", "c41", "c42", "c43", "c44", "c45", "c46", "c47", "c48", "c49")
        VALUES ('c00', 'c01', 'c02', 'c03', 'c04', 'c05', 'c06', 'c07', 'c08', 'c09', 'c10', 'c11', 'c12', 'c13', 'c14', 'c15', 'c16', 'c17', 'c18', 'c19', 'c20', 'c21', 'c22', 'c23', 'c24', 'c25', 'c26', 'c27', 'c28', 'c29', 'c30', 'c31', 'c32', 'c33', 'c34', 'c35', 'c36', 'c37', 'c38', 'c39', 'c40', 'c41', 'c42', 'c43', 'c44', 'c45', 'c46', 'c47', 'c48', 'c49');
      END LOOP;
      RETURN;
    END;
    $body$
    LANGUAGE 'plpgsql'
    VOLATILE
    CALLED ON NULL INPUT
    SECURITY INVOKER
    COST 100;



    Test Methods calling the function and querying the data.

    using System;
    using System.Diagnostics;
    using CRMModels;
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using System.Linq;
    using System.Linq.Dynamic;
     
    namespace UnitTests_CRMModels
    {
        [TestClass]
        public class UnitTest
        {
            [TestMethod]
            public void Test_CreateTestData()
            {
                using (var db = new CRMEntitiesModel ())
                {
                    db.ExecuteNonQuery("audit.test_f", System.Data.CommandType.StoredProcedure);
                    db.SaveChanges();
                }
            }
     
            [TestMethod]
            public void Test_LoadLargeData()
            {
                using (var db = new CRMEntitiesModel())
                {
                    var q = db.Tests.Select("new (Id, C00, C01, C02, C03, C04, C05, C06, C07, C08, C09, C10, C11, C12, C13, C14, C15, C16, C17, C18, C19, C20, C21, C22, C23, C24, C25, C26, C27, C28, C29, C30, C31, C32, C33, C34, C35, C36, C37, C38, C39, C40, C41, C42, C43, C44, C45)");
                    var test = q.Cast<object>().ToArray();  // <= InvalidOperationException
                    Assert.IsNotNull(test);
                    Debug.WriteLine(test.Length);
                }
            }
        }
    }
  2. Zlatko
    Zlatko avatar
    30 posts
    Member since:
    Sep 2013

    Posted 31 Jan 2017 in reply to Zlatko Link to this post

    There is the error message from Exception:

    Error executing query: System.InvalidOperationException: Invalid attempt to read from column ordinal '23'. With CommandBehavior.SequentialAccess, you may only read from column ordinal '24' or greater.
       at Npgsql.ForwardsOnlyRow.SetIndex(Int32 index, Boolean allowCurrent)
       at Npgsql.ForwardsOnlyRow.get_Item(Int32 index)
       at Npgsql.CachingRow.get_Item(Int32 index)
       at Npgsql.CachingRow.IsDBNull(Int32 index)
       at Npgsql.ForwardsOnlyDataReader.IsDBNull(Int32 i)
       at OpenAccessRuntime.Data.VariableLengthStringConverter.Read(DataHolder& data)
       at Telerik.OpenAccess.RT.Adonet2Generic.Impl.BufferingReader.GetValuesInternal()
       at Telerik.OpenAccess.RT.Adonet2Generic.Impl.BufferingReader.EnsureRead(Int32 rdpos)
       at Telerik.OpenAccess.RT.Adonet2Generic.Impl.BufferingReader.EnsureLastRowRead()
       at Telerik.OpenAccess.RT.Adonet2Generic.Impl.BufferingReader.HandleImmediateResolve()
       at Telerik.OpenAccess.RT.Adonet2Generic.Impl.BufferingReader.SetConverter(ConverterUsage[] usages)
       at Telerik.OpenAccess.RT.Adonet2Generic.Impl.ResultSetImp.SetConverter(ConverterUsage[] c)
       at OpenAccessRuntime.Relational.fetch.FetchResultImp.SetResultSet(ResultSet aRs)
       at OpenAccessRuntime.Relational.fetch.FetchResultImp.Execute()
    SQL:
    SELECT a."id" AS COL1, a."c00" AS COL2, a."c01" AS COL3, a."c02" AS COL4, a."c03" AS COL5, a."c04" AS COL6, a."c05" AS COL7, a."c06" AS COL8, a."c07" AS COL9, a."c08" AS COL10, a."c09" AS COL11, a."c10" AS COL12, a."c11" AS COL13, a."c12" AS COL14, a."c13" AS COL15, a."c14" AS COL16, a."c15" AS COL17, a."c16" AS COL18, a."c17" AS COL19, a."c18" AS COL20, a."c19" AS COL21, a."c20" AS COL22, a."c21" AS COL23, a."c22" AS COL24, a."c23" AS COL25, a."c24" AS COL26, a."c25" AS COL27, a."c26" AS COL28, a."c27" AS COL29, a."c28" AS COL30, a."c29" AS COL31, a."c30" AS COL32, a."c31" AS COL33, a."c32" AS COL34, a."c33" AS COL35, a."c34" AS COL36, a."c35" AS COL37, a."c36" AS COL38, a."c37" AS COL39, a."c38" AS COL40, a."c39" AS COL41, a."c40" AS COL42, a."c41" AS COL43, a."c42" AS COL44, a."c43" AS COL45, a."c44" AS COL46, a."c45" AS COL47 FROM "audit"."test" AS a  System.InvalidOperationException: Invalid attempt to read from column ordinal '23'. With CommandBehavior.SequentialAccess, you may only read from column ordinal '24' or greater.
       at Npgsql.ForwardsOnlyRow.SetIndex(Int32 index, Boolean allowCurrent)
       at Npgsql.ForwardsOnlyRow.get_Item(Int32 index)
       at Npgsql.CachingRow.get_Item(Int32 index)
       at Npgsql.CachingRow.IsDBNull(Int32 index)
       at Npgsql.ForwardsOnlyDataReader.IsDBNull(Int32 i)
       at OpenAccessRuntime.Data.VariableLengthStringConverter.Read(DataHolder& data)
       at Telerik.OpenAccess.RT.Adonet2Generic.Impl.BufferingReader.GetValuesInternal()
       at Telerik.OpenAccess.RT.Adonet2Generic.Impl.BufferingReader.EnsureRead(Int32 rdpos)
       at Telerik.OpenAccess.RT.Adonet2Generic.Impl.BufferingReader.EnsureLastRowRead()
       at Telerik.OpenAccess.RT.Adonet2Generic.Impl.BufferingReader.HandleImmediateResolve()
       at Telerik.OpenAccess.RT.Adonet2Generic.Impl.BufferingReader.SetConverter(ConverterUsage[] usages)
       at Telerik.OpenAccess.RT.Adonet2Generic.Impl.ResultSetImp.SetConverter(ConverterUsage[] c)
       at OpenAccessRuntime.Relational.fetch.FetchResultImp.SetResultSet(ResultSet aRs)
       at OpenAccessRuntime.Relational.fetch.FetchResultImp.Execute()

  3. Zlatko
    Zlatko avatar
    30 posts
    Member since:
    Sep 2013

    Posted 31 Jan 2017 in reply to Zlatko Link to this post

    Error executing query: System.InvalidOperationException: Invalid attempt to read from column ordinal '23'. With CommandBehavior.SequentialAccess, you may only read from column ordinal '24' or greater.
       at Npgsql.ForwardsOnlyRow.SetIndex(Int32 index, Boolean allowCurrent)
       at Npgsql.ForwardsOnlyRow.get_Item(Int32 index)
       at Npgsql.CachingRow.get_Item(Int32 index)
       at Npgsql.CachingRow.IsDBNull(Int32 index)
       at Npgsql.ForwardsOnlyDataReader.IsDBNull(Int32 i)
       at OpenAccessRuntime.Data.VariableLengthStringConverter.Read(DataHolder& data)
       at Telerik.OpenAccess.RT.Adonet2Generic.Impl.BufferingReader.GetValuesInternal()
       at Telerik.OpenAccess.RT.Adonet2Generic.Impl.BufferingReader.EnsureRead(Int32 rdpos)
       at Telerik.OpenAccess.RT.Adonet2Generic.Impl.BufferingReader.EnsureLastRowRead()
       at Telerik.OpenAccess.RT.Adonet2Generic.Impl.BufferingReader.HandleImmediateResolve()
       at Telerik.OpenAccess.RT.Adonet2Generic.Impl.BufferingReader.SetConverter(ConverterUsage[] usages)
       at Telerik.OpenAccess.RT.Adonet2Generic.Impl.ResultSetImp.SetConverter(ConverterUsage[] c)
       at OpenAccessRuntime.Relational.fetch.FetchResultImp.SetResultSet(ResultSet aRs)
       at OpenAccessRuntime.Relational.fetch.FetchResultImp.Execute()
    SQL:
    SELECT a."id" AS COL1, a."c00" AS COL2, a."c01" AS COL3, a."c02" AS COL4, a."c03" AS COL5, a."c04" AS COL6, a."c05" AS COL7, a."c06" AS COL8, a."c07" AS COL9, a."c08" AS COL10, a."c09" AS COL11, a."c10" AS COL12, a."c11" AS COL13, a."c12" AS COL14, a."c13" AS COL15, a."c14" AS COL16, a."c15" AS COL17, a."c16" AS COL18, a."c17" AS COL19, a."c18" AS COL20, a."c19" AS COL21, a."c20" AS COL22, a."c21" AS COL23, a."c22" AS COL24, a."c23" AS COL25, a."c24" AS COL26, a."c25" AS COL27, a."c26" AS COL28, a."c27" AS COL29, a."c28" AS COL30, a."c29" AS COL31, a."c30" AS COL32, a."c31" AS COL33, a."c32" AS COL34, a."c33" AS COL35, a."c34" AS COL36, a."c35" AS COL37, a."c36" AS COL38, a."c37" AS COL39, a."c38" AS COL40, a."c39" AS COL41, a."c40" AS COL42, a."c41" AS COL43, a."c42" AS COL44, a."c43" AS COL45, a."c44" AS COL46, a."c45" AS COL47 FROM "audit"."test" AS a  System.InvalidOperationException: Invalid attempt to read from column ordinal '23'. With CommandBehavior.SequentialAccess, you may only read from column ordinal '24' or greater.
       at Npgsql.ForwardsOnlyRow.SetIndex(Int32 index, Boolean allowCurrent)
       at Npgsql.ForwardsOnlyRow.get_Item(Int32 index)
       at Npgsql.CachingRow.get_Item(Int32 index)
       at Npgsql.CachingRow.IsDBNull(Int32 index)
       at Npgsql.ForwardsOnlyDataReader.IsDBNull(Int32 i)
       at OpenAccessRuntime.Data.VariableLengthStringConverter.Read(DataHolder& data)
       at Telerik.OpenAccess.RT.Adonet2Generic.Impl.BufferingReader.GetValuesInternal()
       at Telerik.OpenAccess.RT.Adonet2Generic.Impl.BufferingReader.EnsureRead(Int32 rdpos)
       at Telerik.OpenAccess.RT.Adonet2Generic.Impl.BufferingReader.EnsureLastRowRead()
       at Telerik.OpenAccess.RT.Adonet2Generic.Impl.BufferingReader.HandleImmediateResolve()
       at Telerik.OpenAccess.RT.Adonet2Generic.Impl.BufferingReader.SetConverter(ConverterUsage[] usages)
       at Telerik.OpenAccess.RT.Adonet2Generic.Impl.ResultSetImp.SetConverter(ConverterUsage[] c)
       at OpenAccessRuntime.Relational.fetch.FetchResultImp.SetResultSet(ResultSet aRs)
       at OpenAccessRuntime.Relational.fetch.FetchResultImp.Execute()

  4. Zlatko
    Zlatko avatar
    30 posts
    Member since:
    Sep 2013

    Posted 09 Feb 2017 Link to this post

    Някой от телерик чете ли ги изобщо тези неща? 10 дни и никакво движение.
  5. Zlatko
    Zlatko avatar
    30 posts
    Member since:
    Sep 2013

    Posted 15 Mar 2017 Link to this post

    Hi Telerik Team
    I still waiting for your attention.

     

  6. Zlatko
    Zlatko avatar
    30 posts
    Member since:
    Sep 2013

    Posted 29 May 2017 Link to this post

    Still no answer. Shame on you! 
Back to Top