Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EF6 and iQueryable.Skip(n).Take(k) problem #149

Closed
Civickas opened this issue Jan 26, 2014 · 4 comments
Closed

EF6 and iQueryable.Skip(n).Take(k) problem #149

Civickas opened this issue Jan 26, 2014 · 4 comments

Comments

@Civickas
Copy link

On code "iQueryable.Skip(n).Take(k)" I get error:
"ERROR: 42703: column Extent1.User_Id does not exist"
And other:
"ERROR: 42703: column Extent1.C1 does not exist"
I guess the similar problem is here:
http://pgfoundry.org/forum/forum.php?thread_id=15594&forum_id=519&group_id=1000140

Any fix?

More information:
//query of iQueryable
SELECT "Extent1"."Id" AS "Id","Extent1"."ContractInitiatedDate" AS "ContractInitiatedDate","Extent1"."ContractSentDate" AS "ContractSentDate","Extent1"."ContractSignedDate" AS "ContractSignedDate","Extent1"."UserId" AS "UserId","Extent1"."ResponsibleUserId" AS "ResponsibleUserId","Extent2"."Id" AS "Id1","Extent2"."Email" AS "Email","Extent2"."Phone" AS "Phone","Extent2"."Password" AS "Password","Extent2"."Firstname" AS "Firstname","Extent2"."Lastname" AS "Lastname","Extent2"."Position" AS "Position","Extent2"."Rights" AS "Rights","Extent2"."Ip" AS "Ip","Extent2"."LastActive" AS "LastActive","Extent2"."ProjectDatabaseId" AS "ProjectDatabaseId","Extent2"."CountryId" AS "CountryId","Extent2"."CarrierId" AS "CarrierId","Extent3"."Id" AS "Id2","Extent3"."Email" AS "Email1","Extent3"."Phone" AS "Phone1","Extent3"."Password" AS "Password1","Extent3"."Firstname" AS "Firstname1","Extent3"."Lastname" AS "Lastname1","Extent3"."Position" AS "Position1","Extent3"."Rights" AS "Rights1","Extent3"."Ip" AS "Ip1","Extent3"."LastActive" AS "LastActive1","Extent3"."ProjectDatabaseId" AS "ProjectDatabaseId1","Extent3"."CountryId" AS "CountryId1","Extent3"."CarrierId" AS "CarrierId1","Extent5"."Id" AS "Id3","Extent5"."Name" AS "Name","Extent5"."PhoneCode" AS "PhoneCode","Extent4"."Id" AS "Id4","Extent4"."Name" AS "Name1","Extent1"."User_Id" AS "User_Id","Extent1"."User_Id1" AS "User_Id1" FROM "public"."Prospect" AS "Extent1" INNER JOIN "public"."User" AS "Extent2" ON "Extent1"."ResponsibleUserId"="Extent2"."Id" INNER JOIN "public"."User" AS "Extent3" ON "Extent1"."UserId"="Extent3"."Id" INNER JOIN "public"."Carrier" AS "Extent4" ON "Extent3"."CarrierId"="Extent4"."Id" INNER JOIN "public"."Country" AS "Extent5" ON "Extent3"."CountryId"="Extent5"."Id" ORDER BY "Extent2"."Firstname" ASC ,"Extent2"."Lastname" ASC ,"Extent4"."Name" ASC
//error
[NpgsqlException (0x80004005): ERROR: 42703: column Extent1.User_Id does not exist] Npgsql.<ProcessBackendResponses_Ver_3>d__9.MoveNext() +4069 Npgsql.ForwardsOnlyDataReader.GetNextResponseObject(Boolean cleanup) +1215 Npgsql.ForwardsOnlyDataReader.GetNextRowDescription() +128 Npgsql.ForwardsOnlyDataReader.NextResultInternal() +89 Npgsql.ForwardsOnlyDataReader..ctor(IEnumerable1 dataEnumeration, CommandBehavior behavior, NpgsqlCommand command, NotificationThreadBlock threadBlock, Boolean preparedStatement, NpgsqlRowDescription rowDescription) +216 Npgsql.NpgsqlCommand.GetReader(CommandBehavior cb) +737 Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior cb) +262 Npgsql.NpgsqlCommand.ExecuteDbDataReader(CommandBehavior behavior) +41 System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior) +10 System.Data.Entity.Infrastructure.Interception.<>c__DisplayClassb.<Reader>b__8() +69 System.Data.Entity.Infrastructure.Interception.InternalDispatcher1.Dispatch(Func1 operation, TInterceptionContext interceptionContext, Action1 executing, Action1 executed) +93 System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.Reader(DbCommand command, DbCommandInterceptionContext interceptionContext) +319 System.Data.Entity.Internal.InterceptableDbCommand.ExecuteDbDataReader(CommandBehavior behavior) +240 System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior) +10 System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior) +97

//another query of iQueryable
SELECT "Project1"."Id" AS "Id","Project1"."Name" AS "Name","Project1"."C2" AS "C1","Project1"."Id1" AS "Id1","Project1"."Email" AS "Email","Project1"."Phone" AS "Phone","Project1"."Password" AS "Password","Project1"."Firstname" AS "Firstname","Project1"."Lastname" AS "Lastname","Project1"."Position" AS "Position","Project1"."Rights" AS "Rights","Project1"."Ip" AS "Ip","Project1"."LastActive" AS "LastActive","Project1"."ProjectDatabaseId" AS "ProjectDatabaseId","Project1"."CountryId" AS "CountryId","Project1"."CarrierId" AS "CarrierId","Project1"."Id2" AS "Id2","Project1"."Name1" AS "Name1" FROM (SELECT cast(FALSE as boolean) AS "C1","Extent1"."Id" AS "Id","Extent1"."Name" AS "Name","Extent2"."Id" AS "Id1","Extent2"."Email" AS "Email","Extent2"."Phone" AS "Phone","Extent2"."Password" AS "Password","Extent2"."Firstname" AS "Firstname","Extent2"."Lastname" AS "Lastname","Extent2"."Position" AS "Position","Extent2"."Rights" AS "Rights","Extent2"."Ip" AS "Ip","Extent2"."LastActive" AS "LastActive","Extent2"."ProjectDatabaseId" AS "ProjectDatabaseId","Extent2"."CountryId" AS "CountryId","Extent2"."CarrierId" AS "CarrierId","Extent3"."Id" AS "Id2","Extent3"."Name" AS "Name1", CASE WHEN ("Extent2"."Id" IS NULL ) THEN (CAST (NULL AS int4)) ELSE (1) END AS "C2" FROM "public"."ProjectDatabase" AS "Extent1" LEFT OUTER JOIN "public"."User" AS "Extent2" INNER JOIN "public"."Carrier" AS "Extent3" ON "Extent2"."CarrierId"="Extent3"."Id" ON "Extent1"."Id"="Extent2"."ProjectDatabaseId") AS "Project1" ORDER BY "Project1"."C1" ASC ,"Project1"."Id" ASC ,"Project1"."C2" ASC
//error
[NpgsqlException (0x80004005): ERROR: 42703: column Extent1.C1 does not exist] Npgsql.<ProcessBackendResponses_Ver_3>d__9.MoveNext() +4069 Npgsql.ForwardsOnlyDataReader.GetNextResponseObject(Boolean cleanup) +1215 Npgsql.ForwardsOnlyDataReader.GetNextRowDescription() +128 Npgsql.ForwardsOnlyDataReader.NextResultInternal() +89 Npgsql.ForwardsOnlyDataReader..ctor(IEnumerable1 dataEnumeration, CommandBehavior behavior, NpgsqlCommand command, NotificationThreadBlock threadBlock, Boolean preparedStatement, NpgsqlRowDescription rowDescription) +216 Npgsql.NpgsqlCommand.GetReader(CommandBehavior cb) +737 Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior cb) +262 Npgsql.NpgsqlCommand.ExecuteDbDataReader(CommandBehavior behavior) +41 System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior) +10 System.Data.Entity.Infrastructure.Interception.<>c__DisplayClassb.<Reader>b__8() +69 System.Data.Entity.Infrastructure.Interception.InternalDispatcher1.Dispatch(Func1 operation, TInterceptionContext interceptionContext, Action1 executing, Action1 executed) +93 System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.Reader(DbCommand command, DbCommandInterceptionContext interceptionContext) +319 System.Data.Entity.Internal.InterceptableDbCommand.ExecuteDbDataReader(CommandBehavior behavior) +240 System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior) +10 System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior) +97

On these iQueryable I do "iQueryable.Skip(n).Take(k)" and get errors.

I am using Npgsql 2.1.0-beta1 + Npgsql.EntityFramework

@Civickas
Copy link
Author

Any fix for this?

@Civickas Civickas reopened this Feb 25, 2014
@franciscojunior
Copy link
Member

Hi, @Civickas ! Sorry for not returning to you about that. I still couldn't check what is happening here. But I wanted to let you know that I'm aware of it.

@Emill
Copy link
Contributor

Emill commented Jun 16, 2014

Hi. Can you make sure to include the full generated SQL query?
I think that the SQL you show is generated from the inner IQueryable, since the output doesn't contain any OFFSET or LIMIT, which it should if .Take(n).Skip(k) was applied.

If possible, could you also show the source linq query?

@roji
Copy link
Member

roji commented Aug 7, 2015

Closing after long inactivity, please reopen if still relevant.

@roji roji closed this as completed Aug 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants