{"action":"created","issue":{"url":"https://api.github.com/repos/andialbrecht/sqlparse/issues/170","labels_url":"https://api.github.com/repos/andialbrecht/sqlparse/issues/170/labels{/name}","comments_url":"https://api.github.com/repos/andialbrecht/sqlparse/issues/170/comments","events_url":"https://api.github.com/repos/andialbrecht/sqlparse/issues/170/events","html_url":"https://github.com/andialbrecht/sqlparse/pull/170","id":56863906,"number":170,"title":"(postgresql) Add support for square bracket array indexing","user":{"login":"darikg","id":6875882,"avatar_url":"https://avatars.githubusercontent.com/u/6875882?v=3","gravatar_id":"","url":"https://api.github.com/users/darikg","html_url":"https://github.com/darikg","followers_url":"https://api.github.com/users/darikg/followers","following_url":"https://api.github.com/users/darikg/following{/other_user}","gists_url":"https://api.github.com/users/darikg/gists{/gist_id}","starred_url":"https://api.github.com/users/darikg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/darikg/subscriptions","organizations_url":"https://api.github.com/users/darikg/orgs","repos_url":"https://api.github.com/users/darikg/repos","events_url":"https://api.github.com/users/darikg/events{/privacy}","received_events_url":"https://api.github.com/users/darikg/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/andialbrecht/sqlparse/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/andialbrecht/sqlparse/milestones/12","labels_url":"https://api.github.com/repos/andialbrecht/sqlparse/milestones/12/labels","id":885480,"number":12,"title":"0.1.15","description":"","creator":{"login":"andialbrecht","id":25632,"avatar_url":"https://avatars.githubusercontent.com/u/25632?v=3","gravatar_id":"","url":"https://api.github.com/users/andialbrecht","html_url":"https://github.com/andialbrecht","followers_url":"https://api.github.com/users/andialbrecht/followers","following_url":"https://api.github.com/users/andialbrecht/following{/other_user}","gists_url":"https://api.github.com/users/andialbrecht/gists{/gist_id}","starred_url":"https://api.github.com/users/andialbrecht/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andialbrecht/subscriptions","organizations_url":"https://api.github.com/users/andialbrecht/orgs","repos_url":"https://api.github.com/users/andialbrecht/repos","events_url":"https://api.github.com/users/andialbrecht/events{/privacy}","received_events_url":"https://api.github.com/users/andialbrecht/received_events","type":"User","site_admin":false},"open_issues":2,"closed_issues":9,"state":"open","created_at":"2014-12-01T08:21:36Z","updated_at":"2015-02-08T15:53:28Z","due_on":null,"closed_at":null},"comments":2,"created_at":"2015-02-06T20:30:42Z","updated_at":"2015-02-08T17:47:04Z","closed_at":"2015-02-08T15:53:22Z","pull_request":{"url":"https://api.github.com/repos/andialbrecht/sqlparse/pulls/170","html_url":"https://github.com/andialbrecht/sqlparse/pull/170","diff_url":"https://github.com/andialbrecht/sqlparse/pull/170.diff","patch_url":"https://github.com/andialbrecht/sqlparse/pull/170.patch"},"body":"Postgresql supports arrays as a native column type, which are indexed with square brackets. Currently, square brackets are only supported for sqlite-style escaping (see e.g. #153). This PR adds preliminary support for postgres-style array indexing without breaking the sqlite escaping. It adds a new token type Punctuation.ArrayIndex. Matched square brackets that are immediately preceded by either an alphanumeric character, or a ] character are considered array indices, but everything else is still a sqlite-style escape.\r\n\r\nE.g. these are sqlite escaped columns: `[column1], schema.[column2], [column3]+[column4]`\r\nBut these are array indices: `column1[column2], column3[1:2][5:10]`\r\n\r\nArrayIndex tokens are grouped with the preceding tokens into Identifier objects. A convenience method get_array_indices() is added to the Identifier class. \r\n\r\nEmpty square brackets are also considered array indices. This allows postgresql array type definitions, e.g. `CREATE TABLE tbl (col1 INT[], col2 TEXT[][])`. I couldn't figure out how to group these with the preceding Name.Builtin token, so right now they just float around as standalone Punctuation.ArrayIndex tokens, which doesn't seem to cause any major issues."},"comment":{"url":"https://api.github.com/repos/andialbrecht/sqlparse/issues/comments/73421958","html_url":"https://github.com/andialbrecht/sqlparse/pull/170#issuecomment-73421958","issue_url":"https://api.github.com/repos/andialbrecht/sqlparse/issues/170","id":73421958,"user":{"login":"darikg","id":6875882,"avatar_url":"https://avatars.githubusercontent.com/u/6875882?v=3","gravatar_id":"","url":"https://api.github.com/users/darikg","html_url":"https://github.com/darikg","followers_url":"https://api.github.com/users/darikg/followers","following_url":"https://api.github.com/users/darikg/following{/other_user}","gists_url":"https://api.github.com/users/darikg/gists{/gist_id}","starred_url":"https://api.github.com/users/darikg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/darikg/subscriptions","organizations_url":"https://api.github.com/users/darikg/orgs","repos_url":"https://api.github.com/users/darikg/repos","events_url":"https://api.github.com/users/darikg/events{/privacy}","received_events_url":"https://api.github.com/users/darikg/received_events","type":"User","site_admin":false},"created_at":"2015-02-08T17:47:04Z","updated_at":"2015-02-08T17:47:04Z","body":"Thanks Andi!"}}