{"action":"created","issue":{"url":"https://api.github.com/repos/peopledoc/django-north/issues/33","repository_url":"https://api.github.com/repos/peopledoc/django-north","labels_url":"https://api.github.com/repos/peopledoc/django-north/issues/33/labels{/name}","comments_url":"https://api.github.com/repos/peopledoc/django-north/issues/33/comments","events_url":"https://api.github.com/repos/peopledoc/django-north/issues/33/events","html_url":"https://github.com/peopledoc/django-north/issues/33","id":330183042,"node_id":"MDU6SXNzdWUzMzAxODMwNDI=","number":33,"title":"Add a \"DISCARD ALL\" instruction between each file run","user":{"login":"brunobord","id":25185,"node_id":"MDQ6VXNlcjI1MTg1","avatar_url":"https://avatars1.githubusercontent.com/u/25185?v=4","gravatar_id":"","url":"https://api.github.com/users/brunobord","html_url":"https://github.com/brunobord","followers_url":"https://api.github.com/users/brunobord/followers","following_url":"https://api.github.com/users/brunobord/following{/other_user}","gists_url":"https://api.github.com/users/brunobord/gists{/gist_id}","starred_url":"https://api.github.com/users/brunobord/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brunobord/subscriptions","organizations_url":"https://api.github.com/users/brunobord/orgs","repos_url":"https://api.github.com/users/brunobord/repos","events_url":"https://api.github.com/users/brunobord/events{/privacy}","received_events_url":"https://api.github.com/users/brunobord/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-06-07T09:10:12Z","updated_at":"2018-06-07T09:27:56Z","closed_at":null,"author_association":"NONE","body":"* Django North version: latest\r\n* Django version: Django 1.11\r\n* Python version: 2.7\r\n* Operating System: Debian (inside a LXC)\r\n* starting of Postgres 9.6.8\r\n\r\n### Description\r\n\r\nWhen you're running several files that have a ``set search_path`` **and** that the SQL instructions do not contain explicit schema names (e.g. \"INSERT INTO tablename\" instead of \"INSERT INTO schemaname.tablename\"), it may happen the following:\r\n\r\n0. opening ``file1.sql``\r\n1. ``set search_path = X``;\r\n2. a set of SQL instructions, that will be applied to schema X.\r\n3. opening ``file2.sql`` -- this file doesn't explicitly change the search path, but assumes that the search path is the user's (e.g. \"public\")\r\n4. a set of SQL instructions that will fail... because the current search_path **is still X**\r\n\r\nNote: this behaviour was introduced by PG 9.6.8 for security reasons.\r\n\r\n### Solution\r\n\r\nWe may want to explicitly run a SQL instruction that resets any contextual value (search_path included, but not only) after each file executed:\r\n\r\n```sql\r\nDISCARD ALL;\r\n```\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/peopledoc/django-north/issues/comments/395355387","html_url":"https://github.com/peopledoc/django-north/issues/33#issuecomment-395355387","issue_url":"https://api.github.com/repos/peopledoc/django-north/issues/33","id":395355387,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NTM1NTM4Nw==","user":{"login":"marco44","id":294693,"node_id":"MDQ6VXNlcjI5NDY5Mw==","avatar_url":"https://avatars1.githubusercontent.com/u/294693?v=4","gravatar_id":"","url":"https://api.github.com/users/marco44","html_url":"https://github.com/marco44","followers_url":"https://api.github.com/users/marco44/followers","following_url":"https://api.github.com/users/marco44/following{/other_user}","gists_url":"https://api.github.com/users/marco44/gists{/gist_id}","starred_url":"https://api.github.com/users/marco44/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marco44/subscriptions","organizations_url":"https://api.github.com/users/marco44/orgs","repos_url":"https://api.github.com/users/marco44/repos","events_url":"https://api.github.com/users/marco44/events{/privacy}","received_events_url":"https://api.github.com/users/marco44/received_events","type":"User","site_admin":false},"created_at":"2018-06-07T09:27:56Z","updated_at":"2018-06-07T09:27:56Z","author_association":"NONE","body":"Well, that would mean that the execution of each script is dependant of the fact that the previous one hasn't forgot to reset its parameter. Wouldn't it be more robust to make sure that each script is run with a clean slate, directly from django north ?"}}
{"actor":{"display_login":"marco44"}}