public void QueryTree() { using (var context = new BloggingContext(ConnectionString)) { context.Database.Log = Console.Out.WriteLine; var blog = new Blog { Name = "_" }; context.Blogs.Add(blog); context.SaveChanges(); var queryTree = context .Blogs .Select(x => NpgsqlTextFunctions.QueryTree(NpgsqlTextFunctions.ToTsQuery("foo & ! bar"))) .FirstOrDefault(); Assert.That( NpgsqlTsQuery.Parse(queryTree).ToString(), Is.EqualTo(NpgsqlTsQuery.Parse("'foo'").ToString())); } }