{"action":"created","issue":{"url":"https://api.github.com/repos/begriffs/postgrest/issues/670","repository_url":"https://api.github.com/repos/begriffs/postgrest","labels_url":"https://api.github.com/repos/begriffs/postgrest/issues/670/labels{/name}","comments_url":"https://api.github.com/repos/begriffs/postgrest/issues/670/comments","events_url":"https://api.github.com/repos/begriffs/postgrest/issues/670/events","html_url":"https://github.com/begriffs/postgrest/issues/670","id":164942692,"number":670,"title":"recursive query possible?","user":{"login":"rkoberg","id":83722,"avatar_url":"https://avatars.githubusercontent.com/u/83722?v=3","gravatar_id":"","url":"https://api.github.com/users/rkoberg","html_url":"https://github.com/rkoberg","followers_url":"https://api.github.com/users/rkoberg/followers","following_url":"https://api.github.com/users/rkoberg/following{/other_user}","gists_url":"https://api.github.com/users/rkoberg/gists{/gist_id}","starred_url":"https://api.github.com/users/rkoberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rkoberg/subscriptions","organizations_url":"https://api.github.com/users/rkoberg/orgs","repos_url":"https://api.github.com/users/rkoberg/repos","events_url":"https://api.github.com/users/rkoberg/events{/privacy}","received_events_url":"https://api.github.com/users/rkoberg/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-07-11T21:48:37Z","updated_at":"2016-07-11T22:04:10Z","closed_at":null,"body":"I have a \"regions\" table like:\r\n```\r\nid  |  name  |  parent_id\r\n```\r\nparent_id references an id in the same table. These URLs seem to be equal: \r\n```\r\n/regions?id=eq.7dcabff6-4a60-4ef5-b0a5-e22440c69f02&select=*,parent{*}\r\n/regions?id=eq.7dcabff6-4a60-4ef5-b0a5-e22440c69f02&select=*,regions{*}\r\n```\r\nand produce:\r\n```\r\n[\r\n  {\r\n    \"id\": \"7dcabff6-4a60-4ef5-b0a5-e22440c69f02\",\r\n    \"parent_id\": \"5401a69a-687b-4103-9f20-efcfb7955c51\",\r\n    \"name\": \"Mount Barker\",\r\n    \"level\": 2,\r\n    \"parent\": {\r\n      \"id\": \"5401a69a-687b-4103-9f20-efcfb7955c51\",\r\n      \"parent_id\": \"60f036dc-a383-4c16-a4aa-d82bbdd961a6\",\r\n      \"name\": \"Western Australia\",\r\n      \"level\": 1\r\n    }\r\n  }\r\n]\r\n```\r\nIs it possible to make a query select recursively until parent_id is null? (and what would that query be?) \r\n\r\nI don't really want what follows (don't want to manually nest), but this URL produces an error:\r\n```\r\n/regions?id=eq.7dcabff6-4a60-4ef5-b0a5-e22440c69f02&select=*,parent{*,parent{*}}\r\n```\r\n```\r\n{\"details\":\"no relation between parent and parent\",\"message\":\"could not find foreign keys between these entities\"}\r\n```\r\nThe following URL does work, but again I don't want to manually nest these:\r\n```\r\n/regions?id=eq.7dcabff6-4a60-4ef5-b0a5-e22440c69f02&select=*,regions{*,regions{*}}\r\n```\r\nwhich produces:\r\n```\r\n[\r\n  {\r\n    \"id\": \"7dcabff6-4a60-4ef5-b0a5-e22440c69f02\",\r\n    \"parent_id\": \"5401a69a-687b-4103-9f20-efcfb7955c51\",\r\n    \"name\": \"Mount Barker\",\r\n    \"level\": 2,\r\n    \"regions\": {\r\n      \"id\": \"5401a69a-687b-4103-9f20-efcfb7955c51\",\r\n      \"parent_id\": \"60f036dc-a383-4c16-a4aa-d82bbdd961a6\",\r\n      \"name\": \"Western Australia\",\r\n      \"level\": 1,\r\n      \"regions\": {\r\n        \"id\": \"60f036dc-a383-4c16-a4aa-d82bbdd961a6\",\r\n        \"parent_id\": null,\r\n        \"name\": \"Australia\",\r\n        \"level\": 0\r\n      }\r\n    }\r\n  }\r\n]\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/begriffs/postgrest/issues/comments/231879828","html_url":"https://github.com/begriffs/postgrest/issues/670#issuecomment-231879828","issue_url":"https://api.github.com/repos/begriffs/postgrest/issues/670","id":231879828,"user":{"login":"ruslantalpa","id":5537246,"avatar_url":"https://avatars.githubusercontent.com/u/5537246?v=3","gravatar_id":"","url":"https://api.github.com/users/ruslantalpa","html_url":"https://github.com/ruslantalpa","followers_url":"https://api.github.com/users/ruslantalpa/followers","following_url":"https://api.github.com/users/ruslantalpa/following{/other_user}","gists_url":"https://api.github.com/users/ruslantalpa/gists{/gist_id}","starred_url":"https://api.github.com/users/ruslantalpa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ruslantalpa/subscriptions","organizations_url":"https://api.github.com/users/ruslantalpa/orgs","repos_url":"https://api.github.com/users/ruslantalpa/repos","events_url":"https://api.github.com/users/ruslantalpa/events{/privacy}","received_events_url":"https://api.github.com/users/ruslantalpa/received_events","type":"User","site_admin":false},"created_at":"2016-07-11T22:04:10Z","updated_at":"2016-07-11T22:04:10Z","body":"make the maximum possible and it should work (get cut on a null value)"}}
{"actor":{"display_login":"ruslantalpa"}}