{"action":"created","issue":{"url":"https://api.github.com/repos/npgsql/npgsql/issues/565","labels_url":"https://api.github.com/repos/npgsql/npgsql/issues/565/labels{/name}","comments_url":"https://api.github.com/repos/npgsql/npgsql/issues/565/comments","events_url":"https://api.github.com/repos/npgsql/npgsql/issues/565/events","html_url":"https://github.com/npgsql/npgsql/issues/565","id":65438228,"number":565,"title":"Can't create databases when a context is active","user":{"login":"maxbundchen","id":4380152,"avatar_url":"https://avatars.githubusercontent.com/u/4380152?v=3","gravatar_id":"","url":"https://api.github.com/users/maxbundchen","html_url":"https://github.com/maxbundchen","followers_url":"https://api.github.com/users/maxbundchen/followers","following_url":"https://api.github.com/users/maxbundchen/following{/other_user}","gists_url":"https://api.github.com/users/maxbundchen/gists{/gist_id}","starred_url":"https://api.github.com/users/maxbundchen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maxbundchen/subscriptions","organizations_url":"https://api.github.com/users/maxbundchen/orgs","repos_url":"https://api.github.com/users/maxbundchen/repos","events_url":"https://api.github.com/users/maxbundchen/events{/privacy}","received_events_url":"https://api.github.com/users/maxbundchen/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/npgsql/npgsql/labels/bug","name":"bug","color":"e11d21"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/npgsql/npgsql/milestones/10","html_url":"https://github.com/npgsql/npgsql/milestones/2.2.6","labels_url":"https://api.github.com/repos/npgsql/npgsql/milestones/10/labels","id":1001153,"number":10,"title":"2.2.6","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":4,"closed_issues":1,"state":"open","created_at":"2015-03-02T03:50:17Z","updated_at":"2015-03-31T15:59:05Z","due_on":null,"closed_at":null},"comments":19,"created_at":"2015-03-31T12:23:03Z","updated_at":"2015-04-01T11:13:35Z","closed_at":null,"body":"In version 2.2.5 of Npgsql and Npgsql.EntityFramework, when a Entity Framework context is in use the PogstreSQL trows an error when a new database is being created: \"ERROR: 55006: source database \"template1\" is being accessed by other users\".\r\n\r\nThe versions of Npgsql 2.2.4.3 and older don't have this problem. The Entity Frameworks version 6.0.0 to 6.1.3 also don't have this problem with any older version of Npgsql than 2.2.5, so the problem looks like in this assembly.\r\n\r\nThis code illustrates the problem, but it occours if you try to use others tools to create a database like pgAdmin:\r\n\r\n           Database.Setinitializer<DbMaster>(null);\r\n            ...\r\n            // Can create new databases.\r\n            if (!dbMaster.TableChildren.Any())\r\n            {\r\n                // Can't create new databases even with pgAdmin or pg command line.\r\n                using (var connection = new NpgsqlConnection(connectionStringChild))\r\n                {\r\n                    var cmd = new NpgsqlCommand();\r\n                    cmd.Connection = connection;\r\n                    connection.Open();\r\n                    \r\n                    cmd.CommandText = \"create database child1\";\r\n                    cmd.ExecuteNonQuery();\r\n                    }\r\n            }"},"comment":{"url":"https://api.github.com/repos/npgsql/npgsql/issues/comments/88443613","html_url":"https://github.com/npgsql/npgsql/issues/565#issuecomment-88443613","issue_url":"https://api.github.com/repos/npgsql/npgsql/issues/565","id":88443613,"user":{"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},"created_at":"2015-04-01T11:13:35Z","updated_at":"2015-04-01T11:13:35Z","body":"One note - I only fixed the \"assign closed connection to command\" bug in master, not in 2.2."}}