PostgreSQL
![]()
Usage
To install PostgreSQL, run the following command:
choco install postgresql19
To upgrade PostgreSQL, run the following command:
choco upgrade postgresql19
To uninstall PostgreSQL, run the following command:
choco uninstall postgresql19
Description
PostgreSQL is a free, open-source object-relational database management system. It may be used, modified, and distributed for private, commercial, or academic purposes.
Features
- See the Feature Matrix
Package parameters
| Parameter | Description |
|---|---|
/AllowRemote |
Enables remote connections (adds entries to pg_hba.conf). |
/Password |
Sets password for postgres user. If omitted, one is generated. Ignored if PostgreSQL already exists. |
/Port |
Database server port. Defaults to 5432 or next available port. |
/NoPath |
Prevents adding PostgreSQL bin directory to PATH. |
Pass other installer options with --ia:
choco install postgresql13 --params '/Password:test /Port:5433' --ia '--enable-components server,commandlinetools'
Run the
installer
with --help for all options.
Troubleshooting
Installation through SSH or remote automation
The EDB installer can exit with code 1 after a successful download and
checksum
check, reporting:
Error writing file .../postgresql_installer_<id>/temp_check_comspec.bat
The upstream issue
reports this failure in remote sessions and a successful install through RDP.
An
investigation
traces it to USERDOMAIN being WORKGROUP in some SSH sessions, causing
invalid
temporary-directory permissions. This error can also have other causes.
Compare these values in the failing session:
[System.Security.Principal.WindowsIdentity]::GetCurrent().Name
"$env:USERDOMAIN\$env:USERNAME"
For local accounts, <computername>\<username> versus WORKGROUP\<username>
indicates a mismatch. Check the session’s temporary
installbuilder_installer_*.log
for Invalid account. Retry in an elevated console or RDP PowerShell window.
Report persistent failures with the installer log and account comparison.
Notes
- Test installation (specify your password):
$Env:PGPASSWORD='test'; '\conninfo' | psql -UpostgresThis should report a connection to thepostgresdatabase on port5432. - This package will install PostgreSQL to
$Env:ProgramFiles\PostgreSQL\[MajorVersion]. - If you have problems during installation see troubleshooting page.
- To reset a generated password you did not record:
- Open file
data\pg_hba.confin PostgreSql installation directory - Change
METHODtotrustand restart service withRestart-Service postgresql* - Execute
"alter user postgres with password '[my password]';" | psql -Upostgres - Revert back
data\pg_hba.confto METHODmd5and restart service
- Open file
Virtual package
Each major version has a postgresql<Version> package. The virtual
postgresql package
depends on it.
Forward parameters with --params-global; use --force-dependencies to
uninstall
or forcibly reinstall dependencies:
choco install postgresql --params '/Password:test' --params-global
choco uninstall postgresql --force-dependencies
choco install postgresql --force --force-dependencies
Without --force-dependencies, uninstall and forced reinstall affect only the
virtual package.
Forcing dependencies also reinstalls packages such as vcredist140.
Please Note: This is an automatically updated package. If you find it is out of date by more than a day or two, please contact the maintainer(s) and let them know package update issues that the package is no longer updating correctly.