{"action":"created","issue":{"url":"https://api.github.com/repos/npgsql/npgsql/issues/515","labels_url":"https://api.github.com/repos/npgsql/npgsql/issues/515/labels{/name}","comments_url":"https://api.github.com/repos/npgsql/npgsql/issues/515/comments","events_url":"https://api.github.com/repos/npgsql/npgsql/issues/515/events","html_url":"https://github.com/npgsql/npgsql/issues/515","id":59584082,"number":515,"title":"Redshift query fails with: type \"e\" does not exist","user":{"login":"andrewwwooster","id":10394379,"avatar_url":"https://avatars.githubusercontent.com/u/10394379?v=3","gravatar_id":"","url":"https://api.github.com/users/andrewwwooster","html_url":"https://github.com/andrewwwooster","followers_url":"https://api.github.com/users/andrewwwooster/followers","following_url":"https://api.github.com/users/andrewwwooster/following{/other_user}","gists_url":"https://api.github.com/users/andrewwwooster/gists{/gist_id}","starred_url":"https://api.github.com/users/andrewwwooster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrewwwooster/subscriptions","organizations_url":"https://api.github.com/users/andrewwwooster/orgs","repos_url":"https://api.github.com/users/andrewwwooster/repos","events_url":"https://api.github.com/users/andrewwwooster/events{/privacy}","received_events_url":"https://api.github.com/users/andrewwwooster/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/npgsql/npgsql/labels/bug","name":"bug","color":"e11d21"},{"url":"https://api.github.com/repos/npgsql/npgsql/labels/redshift","name":"redshift","color":"eb6420"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/npgsql/npgsql/milestones/8","html_url":"https://github.com/npgsql/npgsql/milestones/2.2.5","labels_url":"https://api.github.com/repos/npgsql/npgsql/milestones/8/labels","id":967745,"number":8,"title":"2.2.5","description":"","creator":{"login":"roji","id":1862641,"avatar_url":"https://avatars.githubusercontent.com/u/1862641?v=3","gravatar_id":"","url":"https://api.github.com/users/roji","html_url":"https://github.com/roji","followers_url":"https://api.github.com/users/roji/followers","following_url":"https://api.github.com/users/roji/following{/other_user}","gists_url":"https://api.github.com/users/roji/gists{/gist_id}","starred_url":"https://api.github.com/users/roji/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/roji/subscriptions","organizations_url":"https://api.github.com/users/roji/orgs","repos_url":"https://api.github.com/users/roji/repos","events_url":"https://api.github.com/users/roji/events{/privacy}","received_events_url":"https://api.github.com/users/roji/received_events","type":"User","site_admin":false},"open_issues":2,"closed_issues":6,"state":"open","created_at":"2015-02-05T21:14:16Z","updated_at":"2015-03-04T08:52:34Z","due_on":null,"closed_at":null},"comments":7,"created_at":"2015-03-03T02:03:11Z","updated_at":"2015-03-04T20:13:37Z","closed_at":null,"body":"I am trying to use Npgsql.EntityFramework with the Amazon Redshift database.  I've gotten beyond #511 but hit a new error.  The following Entity Framework query:\r\n\r\n            var drugCodes = dbContext.DrugCodes\r\n                    .Where(d => d.ProductName == \"V-CILLIN-K\");\r\n\r\nproduces this sql:\r\n\r\n  SELECT \"Extent1\".\"CODE\", \"Extent1\".\"PRODUCT_NAME\", \"Extent1\".\"GENERIC_NAME\" FROM \"dbo\".\"DRUG_CODE\" AS \"Extent1\" WHERE E'V-CILLIN-K' = \"Extent1\".\"PRODUCT_NAME\"\r\n\r\nwhich results in the following error:\r\n\r\n  ERROR: 42704: type \"e\" does not exist\r\n\r\nIt appears that Redshift does not support the postgresql E' escape string constant.\r\n\r\nSee source code https://github.com/npgsql/npgsql/blob/master/Npgsql.EntityFramework/SqlGenerators/VisitedExpression.cs line 222\r\n\r\n\r\nFull Exception:\r\n\r\nTest method Minerva.Tests.Models.Entities.MinervaDbContextTest.DrugCodes_ByProductName_ReturnsMany threw exception: \r\nSystem.Data.Entity.Core.EntityCommandExecutionException: An error occurred while executing the command definition. See the inner exception for details. ---> Npgsql.NpgsqlException: ERROR: 42704: type \"e\" does not exist\r\nResult StackTrace:\t\r\nat Npgsql.NpgsqlState.<ProcessBackendResponses>d__0.MoveNext() in c:\\dev\\TeamCity\\buildAgent\\work\\45caad201a245970\\Npgsql\\Npgsql\\NpgsqlState.BackendResponse.cs:line 310\r\n   at Npgsql.ForwardsOnlyDataReader.GetNextResponseObject(Boolean cleanup) in c:\\dev\\TeamCity\\buildAgent\\work\\45caad201a245970\\Npgsql\\Npgsql\\NpgsqlDataReader.cs:line 1158\r\n   at Npgsql.ForwardsOnlyDataReader.GetNextRowDescription() in c:\\dev\\TeamCity\\buildAgent\\work\\45caad201a245970\\Npgsql\\Npgsql\\NpgsqlDataReader.cs:line 1176\r\n   at Npgsql.ForwardsOnlyDataReader.NextResultInternal() in c:\\dev\\TeamCity\\buildAgent\\work\\45caad201a245970\\Npgsql\\Npgsql\\NpgsqlDataReader.cs:line 1386\r\n   at Npgsql.ForwardsOnlyDataReader..ctor(IEnumerable`1 dataEnumeration, CommandBehavior behavior, NpgsqlCommand command, NotificationThreadBlock threadBlock, Boolean preparedStatement, NpgsqlRowDescription rowDescription) in c:\\dev\\TeamCity\\buildAgent\\work\\45caad201a245970\\Npgsql\\Npgsql\\NpgsqlDataReader.cs:line 1010\r\n   at Npgsql.NpgsqlCommand.GetReader(CommandBehavior cb) in c:\\dev\\TeamCity\\buildAgent\\work\\45caad201a245970\\Npgsql\\Npgsql\\NpgsqlCommand.PrepareExecute.cs:line 279\r\n   at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior cb) in c:\\dev\\TeamCity\\buildAgent\\work\\45caad201a245970\\Npgsql\\Npgsql\\NpgsqlCommand.PrepareExecute.cs:line 234\r\n   at Npgsql.NpgsqlCommand.ExecuteDbDataReader(CommandBehavior behavior) in c:\\dev\\TeamCity\\buildAgent\\work\\45caad201a245970\\Npgsql\\Npgsql\\NpgsqlCommand.PrepareExecute.cs:line 181\r\n   at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)\r\n   at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.<Reader>b__c(DbCommand t, DbCommandInterceptionContext`1 c)\r\n   at System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TTarget,TInterceptionContext,TResult](TTarget target, Func`3 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed)\r\n   at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.Reader(DbCommand command, DbCommandInterceptionContext interceptionContext)\r\n   at System.Data.Entity.Internal.InterceptableDbCommand.ExecuteDbDataReader(CommandBehavior behavior)\r\n   at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)\r\n   at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)\r\n --- End of inner exception stack trace ---\r\n    at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)\r\n   at System.Data.Entity.Core.Objects.Internal.ObjectQueryExecutionPlan.Execute[TResultType](ObjectContext context, ObjectParameterCollection parameterValues)\r\n   at System.Data.Entity.Core.Objects.ObjectQuery`1.<>c__DisplayClass7.<GetResults>b__6()\r\n   at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)\r\n   at System.Data.Entity.Core.Objects.ObjectQuery`1.<>c__DisplayClass7.<GetResults>b__5()\r\n   at System.Data.Entity.Infrastructure.DefaultExecutionStrategy.Execute[TResult](Func`1 operation)\r\n   at System.Data.Entity.Core.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)\r\n   at System.Data.Entity.Core.Objects.ObjectQuery`1.<System.Collections.Generic.IEnumerable<T>.GetEnumerator>b__0()\r\n   at System.Data.Entity.Internal.LazyEnumerator`1.MoveNext()\r\n   at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source)\r\n   at System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.<GetElementFunction>b__3[TResult](IEnumerable`1 sequence)\r\n   at System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.ExecuteSingle[TResult](IEnumerable`1 query, Expression queryRoot)\r\n   at System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.System.Linq.IQueryProvider.Execute[TResult](Expression expression)\r\n   at System.Data.Entity.Internal.Linq.DbQueryProvider.Execute[TResult](Expression expression)\r\n   at System.Linq.Queryable.Count[TSource](IQueryable`1 source)\r\n   at Minerva.Tests.Models.Entities.MinervaDbContextTest.DrugCodes_ByProductName_ReturnsMany() in c:\\Users\\Andrew\\Source\\Repos\\Minerva\\Minerva.Tests\\Models\\Entities\\MinervaDbContextTest.cs:line 21\r\n"},"comment":{"url":"https://api.github.com/repos/npgsql/npgsql/issues/comments/77236726","html_url":"https://github.com/npgsql/npgsql/issues/515#issuecomment-77236726","issue_url":"https://api.github.com/repos/npgsql/npgsql/issues/515","id":77236726,"user":{"login":"franciscojunior","id":829924,"avatar_url":"https://avatars.githubusercontent.com/u/829924?v=3","gravatar_id":"","url":"https://api.github.com/users/franciscojunior","html_url":"https://github.com/franciscojunior","followers_url":"https://api.github.com/users/franciscojunior/followers","following_url":"https://api.github.com/users/franciscojunior/following{/other_user}","gists_url":"https://api.github.com/users/franciscojunior/gists{/gist_id}","starred_url":"https://api.github.com/users/franciscojunior/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/franciscojunior/subscriptions","organizations_url":"https://api.github.com/users/franciscojunior/orgs","repos_url":"https://api.github.com/users/franciscojunior/repos","events_url":"https://api.github.com/users/franciscojunior/events{/privacy}","received_events_url":"https://api.github.com/users/franciscojunior/received_events","type":"User","site_admin":false},"created_at":"2015-03-04T20:13:37Z","updated_at":"2015-03-04T20:13:37Z","body":"From the code: https://github.com/npgsql/npgsql/blob/2.2/Npgsql/Npgsql/NpgsqlConnector.cs#L751 it seems that this support is checked against server version.\r\nBut in this line: https://github.com/npgsql/npgsql/blob/2.2/Npgsql/NpgsqlTypes/NpgsqlTypeInfoNative.cs#L214 It seems that this value is being ignored, as this method call is called without passing an options parameter: https://github.com/npgsql/npgsql/blob/2.2/Npgsql.EntityFramework/SqlGenerators/VisitedExpression.cs#L225\r\n"}}