Skip to content

Honor PGHOST and PGPORT when omitted from database URLs - #823

Merged
dossy merged 1 commit into
amacneil:mainfrom
tianrking:fix-postgres-environment-host-port
Sep 15, 2026
Merged

dossy merged 1 commit into
amacneil:mainfrom
tianrking:fix-postgres-environment-host-port

Conversation

@tianrking

Copy link
Copy Markdown
Contributor

Summary

  • keep PostgreSQL host and port components out of dbmate's rewritten URL when PGHOST or PGPORT supplies the missing value
  • preserve explicit URL/query values and the Redshift 5439 default without emitting an empty hostname that overrides PGHOST
  • cover independent and combined environment values, URL precedence, and the final address selected by lib/pq

Closes #492.

Testing

  • go test ./pkg/driver/postgres -run '^TestConnectionString' -count=1
  • go test ./pkg/driver/postgres -count=1
  • go vet ./pkg/driver/postgres
  • git diff --check

@dossy
dossy merged commit b47bcbd into amacneil:main Sep 15, 2026
10 checks passed
@dossy dossy mentioned this pull request Sep 19, 2026
dossy added a commit that referenced this pull request Sep 19, 2026
Changes since v2.35.1:

* #835
* #803
* #834
* #827
* #785
* #833
* #825
* #823
* #837
* #705
* #814
* #840
* #826
* #841
* #839, #831
* #836
* #832
* #830
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

$PGHOST & $PGPORT are not respected.

2 participants