Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure that schema search path is set with every connection on postgres #14131

Merged

Conversation

zeripath
Copy link
Contributor

Unfortunately every connection to postgres requires that the search path is
set appropriately.

This PR shadows the postgres driver to ensure that as soon as a connection
is open, the search_path is set appropriately.

Fix #14088

Signed-off-by: Andrew Thornton art27@cantab.net

Unfortunately every connection to postgres requires that the search path is
set appropriately.

This PR shadows the postgres driver to ensure that as soon as a connection
is open, the search_path is set appropriately.

Fix go-gitea#14088

Signed-off-by: Andrew Thornton <art27@cantab.net>
@zeripath zeripath added this to the 1.14.0 milestone Dec 23, 2020
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Dec 23, 2020
Signed-off-by: Andrew Thornton <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Dec 24, 2020
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jan 2, 2021
@codecov-io
Copy link

Codecov Report

Merging #14131 (9ba27a8) into master (d44f192) will decrease coverage by 0.02%.
The diff coverage is 5.26%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #14131      +/-   ##
==========================================
- Coverage   42.01%   41.98%   -0.03%     
==========================================
  Files         734      735       +1     
  Lines       78773    78803      +30     
==========================================
- Hits        33093    33086       -7     
- Misses      40245    40276      +31     
- Partials     5435     5441       +6     
Impacted Files Coverage Δ
models/sql_postgres_with_schema.go 0.00% <0.00%> (ø)
models/models.go 57.00% <33.33%> (+1.05%) ⬆️
modules/secret/secret.go 66.66% <0.00%> (-7.41%) ⬇️
modules/git/tree_entry_nogogit.go 87.50% <0.00%> (-6.25%) ⬇️
modules/charset/charset.go 68.53% <0.00%> (-4.50%) ⬇️
services/pull/pull.go 42.35% <0.00%> (-0.51%) ⬇️
modules/process/manager.go 75.00% <0.00%> (+2.50%) ⬆️
models/unit.go 49.31% <0.00%> (+2.73%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d44f192...9ba27a8. Read the comment docs.

@lunny lunny merged commit ac88b0e into go-gitea:master Jan 2, 2021
@lunny
Copy link
Member

lunny commented Jan 2, 2021

@zeripath Please send backport

@zeripath zeripath deleted the fix-14088-set-schema-every-connection branch January 2, 2021 09:22
zeripath added a commit to zeripath/gitea that referenced this pull request Jan 2, 2021
…es (go-gitea#14131)

Backport go-gitea#14131

Unfortunately every connection to postgres requires that the search path is
set appropriately.

This PR shadows the postgres driver to ensure that as soon as a connection
is open, the search_path is set appropriately.

Fix go-gitea#14088

Signed-off-by: Andrew Thornton <art27@cantab.net>
@zeripath zeripath added the backport/done All backports for this PR have been created label Jan 2, 2021
6543 pushed a commit that referenced this pull request Jan 2, 2021
…es (#14131) (#14216)

Backport #14131

Unfortunately every connection to postgres requires that the search path is
set appropriately.

This PR shadows the postgres driver to ensure that as soon as a connection
is open, the search_path is set appropriately.

Fix #14088

Signed-off-by: Andrew Thornton <art27@cantab.net>
@go-gitea go-gitea locked and limited conversation to collaborators Feb 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backport/done All backports for this PR have been created lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using a PostgreSQL schema different from "public" causes error 500
5 participants