Merge pull request #2527 from nsheridan/master

Don't return extra columns in result set
This commit is contained in:
Brad Rydzewski 2018-11-14 08:50:11 -08:00 committed by GitHub
commit a527ac7f29
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 44 additions and 8 deletions

View file

@ -1,10 +1,28 @@
-- name: feed-latest-build
SELECT repo_owner, repo_name, repo_full_name, b.*
SELECT
repo_owner
,repo_name
,repo_full_name
,build_number
,build_event
,build_status
,build_created
,build_started
,build_finished
,build_commit
,build_branch
,build_ref
,build_refspec
,build_remote
,build_title
,build_message
,build_author
,build_email
,build_avatar
FROM repos LEFT OUTER JOIN (
SELECT DISTINCT ON (build_repo_id) build_repo_id, build_id, build_number, build_event, build_status, build_created, build_started, build_finished, build_commit, build_branch, build_ref, build_refspec, build_remote, build_title, build_message, build_author, build_email, build_avatar
FROM builds
ORDER BY build_repo_id, build_id DESC
SELECT DISTINCT ON (build_repo_id) * FROM builds
ORDER BY build_repo_id, build_id DESC
) b ON b.build_repo_id = repos.repo_id
INNER JOIN perms ON perms.perm_repo_id = repos.repo_id
WHERE perms.perm_user_id = $1

View file

@ -98,11 +98,29 @@ SELECT currval('builds_build_id_seq');
`
var feedLatestBuild = `
SELECT repo_owner, repo_name, repo_full_name, b.*
SELECT
repo_owner
,repo_name
,repo_full_name
,build_number
,build_event
,build_status
,build_created
,build_started
,build_finished
,build_commit
,build_branch
,build_ref
,build_refspec
,build_remote
,build_title
,build_message
,build_author
,build_email
,build_avatar
FROM repos LEFT OUTER JOIN (
SELECT DISTINCT ON (build_repo_id) build_repo_id, build_id, build_number, build_event, build_status, build_created, build_started, build_finished, build_commit, build_branch, build_ref, build_refspec, build_remote, build_title, build_message, build_author, build_email, build_avatar
FROM builds
ORDER BY build_repo_id, build_id DESC
SELECT DISTINCT ON (build_repo_id) * FROM builds
ORDER BY build_repo_id, build_id DESC
) b ON b.build_repo_id = repos.repo_id
INNER JOIN perms ON perms.perm_repo_id = repos.repo_id
WHERE perms.perm_user_id = $1