{"action":"created","issue":{"url":"https://api.github.com/repos/cockroachdb/docs/issues/251","repository_url":"https://api.github.com/repos/cockroachdb/docs","labels_url":"https://api.github.com/repos/cockroachdb/docs/issues/251/labels{/name}","comments_url":"https://api.github.com/repos/cockroachdb/docs/issues/251/comments","events_url":"https://api.github.com/repos/cockroachdb/docs/issues/251/events","html_url":"https://github.com/cockroachdb/docs/issues/251","id":152830277,"number":251,"title":"Constraints","user":{"login":"jseldess","id":15893490,"avatar_url":"https://avatars.githubusercontent.com/u/15893490?v=3","gravatar_id":"","url":"https://api.github.com/users/jseldess","html_url":"https://github.com/jseldess","followers_url":"https://api.github.com/users/jseldess/followers","following_url":"https://api.github.com/users/jseldess/following{/other_user}","gists_url":"https://api.github.com/users/jseldess/gists{/gist_id}","starred_url":"https://api.github.com/users/jseldess/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jseldess/subscriptions","organizations_url":"https://api.github.com/users/jseldess/orgs","repos_url":"https://api.github.com/users/jseldess/repos","events_url":"https://api.github.com/users/jseldess/events{/privacy}","received_events_url":"https://api.github.com/users/jseldess/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/cockroachdb/docs/labels/help%20wanted","name":"help wanted","color":"159818"}],"state":"open","locked":false,"assignee":{"login":"uptimeDBA","id":17366371,"avatar_url":"https://avatars.githubusercontent.com/u/17366371?v=3","gravatar_id":"","url":"https://api.github.com/users/uptimeDBA","html_url":"https://github.com/uptimeDBA","followers_url":"https://api.github.com/users/uptimeDBA/followers","following_url":"https://api.github.com/users/uptimeDBA/following{/other_user}","gists_url":"https://api.github.com/users/uptimeDBA/gists{/gist_id}","starred_url":"https://api.github.com/users/uptimeDBA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uptimeDBA/subscriptions","organizations_url":"https://api.github.com/users/uptimeDBA/orgs","repos_url":"https://api.github.com/users/uptimeDBA/repos","events_url":"https://api.github.com/users/uptimeDBA/events{/privacy}","received_events_url":"https://api.github.com/users/uptimeDBA/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/cockroachdb/docs/milestones/2","html_url":"https://github.com/cockroachdb/docs/milestones/Q2","labels_url":"https://api.github.com/repos/cockroachdb/docs/milestones/2/labels","id":1687873,"number":2,"title":"Q2","description":"","creator":{"login":"jseldess","id":15893490,"avatar_url":"https://avatars.githubusercontent.com/u/15893490?v=3","gravatar_id":"","url":"https://api.github.com/users/jseldess","html_url":"https://github.com/jseldess","followers_url":"https://api.github.com/users/jseldess/followers","following_url":"https://api.github.com/users/jseldess/following{/other_user}","gists_url":"https://api.github.com/users/jseldess/gists{/gist_id}","starred_url":"https://api.github.com/users/jseldess/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jseldess/subscriptions","organizations_url":"https://api.github.com/users/jseldess/orgs","repos_url":"https://api.github.com/users/jseldess/repos","events_url":"https://api.github.com/users/jseldess/events{/privacy}","received_events_url":"https://api.github.com/users/jseldess/received_events","type":"User","site_admin":false},"open_issues":25,"closed_issues":16,"state":"open","created_at":"2016-04-06T17:46:54Z","updated_at":"2016-05-13T16:05:16Z","due_on":"2016-06-30T04:00:00Z","closed_at":null},"comments":4,"created_at":"2016-05-03T17:28:11Z","updated_at":"2016-05-15T19:45:56Z","closed_at":null,"body":"Document all the ways you can constrain column data in CockroachDB.\r\n\r\nAt first, we can build out the **Constraints** section on data-definition.md. If it feels like the material warrants a separate page, though, we can add one.\r\n\r\nFor reference:\r\n- Table-level constraints: https://www.cockroachlabs.com/docs/sql-grammar.html#constraint_elem\r\n- Column-level constraints: https://www.cockroachlabs.com/docs/sql-grammar.html#col_qualification_elem\r\n- Test for CHECK constraint: https://github.com/cockroachdb/cockroach/blob/master/sql/testdata/check_constraints\r\n- Test for DEFAULT constraint: https://github.com/cockroachdb/cockroach/blob/master/sql/testdata/default\r\n- Test for PRIMARY KEY: https://github.com/cockroachdb/cockroach/blob/master/sql/testdata/table\r\n- [PostgreSQL constraints](http://www.postgresql.org/docs/9.4/static/ddl-constraints.html)\r\n- [MySQL constraints](http://dev.mysql.com/doc/refman/5.7/en/constraints.html)"},"comment":{"url":"https://api.github.com/repos/cockroachdb/docs/issues/comments/219306333","html_url":"https://github.com/cockroachdb/docs/issues/251#issuecomment-219306333","issue_url":"https://api.github.com/repos/cockroachdb/docs/issues/251","id":219306333,"user":{"login":"uptimeDBA","id":17366371,"avatar_url":"https://avatars.githubusercontent.com/u/17366371?v=3","gravatar_id":"","url":"https://api.github.com/users/uptimeDBA","html_url":"https://github.com/uptimeDBA","followers_url":"https://api.github.com/users/uptimeDBA/followers","following_url":"https://api.github.com/users/uptimeDBA/following{/other_user}","gists_url":"https://api.github.com/users/uptimeDBA/gists{/gist_id}","starred_url":"https://api.github.com/users/uptimeDBA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uptimeDBA/subscriptions","organizations_url":"https://api.github.com/users/uptimeDBA/orgs","repos_url":"https://api.github.com/users/uptimeDBA/repos","events_url":"https://api.github.com/users/uptimeDBA/events{/privacy}","received_events_url":"https://api.github.com/users/uptimeDBA/received_events","type":"User","site_admin":false},"created_at":"2016-05-15T19:45:56Z","updated_at":"2016-05-15T19:45:56Z","body":"I've had a quick look at [](https://github.com/cockroachdb/docs/blob/gh-pages/generate/main.go#L168) and I think you're right. I'll run these through and see what they give.\r\n\r\n`{name: \"column_constraint\", stmt: \"col_qual_list\", inline: []string{\"col_qualification\", \"col_qualification_elem\"}}`\r\n\r\n`{name: \"table_constraint\", stmt: \"table_constraint \", inline: []string{\"constraint_elem\"}}`\r\n"}}