Merge pull request #343 from sosedoff/list-constraint-name

Include constraint name under "constraints" tab
This commit is contained in:
Dan Sosedoff 2018-01-30 23:29:54 -06:00 committed by GitHub
commit 121f278713
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 3 deletions

View File

@ -1,4 +1,6 @@
sudo: required
dist: trusty
group: deprecated-2017Q4
language: go

View File

@ -266,8 +266,9 @@ func test_TableConstraints(t *testing.T) {
res, err := testClient.TableConstraints("editions")
assert.Equal(t, nil, err)
assert.Equal(t, 1, len(res.Columns))
assert.Equal(t, 2, len(res.Rows))
assert.Equal(t, []string{"name", "definition"}, res.Columns)
assert.Equal(t, Row{"pkey", "PRIMARY KEY (isbn)"}, res.Rows[0])
assert.Equal(t, Row{"integrity", "CHECK (book_id IS NOT NULL AND edition IS NOT NULL)"}, res.Rows[1])
}
func test_Query(t *testing.T) {

View File

@ -50,7 +50,8 @@ WHERE
TableConstraints = `
SELECT
pg_get_constraintdef(c.oid, true) as condef
conname as name,
pg_get_constraintdef(c.oid, true) as definition
FROM
pg_constraint c
JOIN