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

Upgrading PostgreSQL 14.5 is not reflected. #82335

Closed
dmdragon opened this issue Sep 30, 2022 · 16 comments
Closed

Upgrading PostgreSQL 14.5 is not reflected. #82335

dmdragon opened this issue Sep 30, 2022 · 16 comments
Labels
Area-External Help-Wanted This is a good candidate work item from the community. Issue-Bug It either shouldn't be doing this or needs an investigation.
Milestone

Comments

@dmdragon
Copy link

Brief description of your issue

Run the PostgreSQL 14 upgrade, the 14.5 installer will be run and the version will be 14.5, but then run the winget upgrade, get PostgreSQL 14.5 again.

Steps to reproduce

  1. Run winget upgrade
  2. Postgres 14 (ID: PostgreSQL.PostgreSQL) Version 14.5 is found.
  3. Run winget upgrade --id PostgreSQL.PostgreSQL
  4. PostgreSQL 14.5 will be installed.
  5. Check the PostgreSQL version, it is 14.5.
    postgres=# SELECT Version();
                              version
    ------------------------------------------------------------
     PostgreSQL 14.5, compiled by Visual C++ build 1914, 64-bit
    
  6. Re-run winget upgrade, also find Postgres 14 version 14.5.

Expected behavior

After the installation of PostgreSQL 14.5 is complete, when run winget upgrade, PostgreSQL does not come up.

Actual behavior

After the installation of PostgreSQL 14.5 is complete, when run winget upgrade, PostgreSQL come up.

Environment

Windows Package Manager v1.3.2091
Windows: Windows.Desktop v10.0.22621.521
System Arthitecture: X64
Package: Microsoft.DesktopAppInstaller v1.18.2091.0
@ghost ghost added the Needs-Triage This work item needs to be triaged by a member of the core team. label Sep 30, 2022
@denelon denelon transferred this issue from microsoft/winget-cli Oct 3, 2022
@denelon denelon added Help-Wanted This is a good candidate work item from the community. and removed Needs-Triage This work item needs to be triaged by a member of the core team. labels Oct 3, 2022
@ghost ghost added the Needs-Triage This work item needs to be triaged by a member of the core team. label Oct 3, 2022
@denelon denelon removed the Needs-Triage This work item needs to be triaged by a member of the core team. label Oct 3, 2022
@denelon
Copy link
Contributor

denelon commented Oct 3, 2022

If running winget upgrade PostgreSQL installs another version and doesn't update the previous version, we may need to look at adding the "uninstallPrevious" key to the manifest. If you run winget list and you see two entries that is likely the case. We've got some work coming to look at the upgrade command to detect if the latest version is already installed and not end up in a loop because the earlier version is still present.

@dmdragon
Copy link
Author

dmdragon commented Oct 5, 2022

Thanks.

When I run winget upgrade PostgreSQL, the latest version of the installer is downloaded, run, and upgraded it, but then run winget upgrade command again, the old version remains on the display and is a candidate for upgrade. When winget list is run, there is one entry.

@jantari
Copy link
Contributor

jantari commented Oct 10, 2022

I looked into this and it is because the Postgres Installer that EnterpriseDB packages doesn't set the Version information in the registry / control panel correctly:

Administrator in ~
❯ Get-ChildItem "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall", "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall" |
∙   Where { $_.GetValue('DisplayName') -like "*post*" }

    Hive: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall

Name                           Property
----                           --------
PostgreSQL 14                  DisplayVersion  : 14
                               Publisher       : PostgreSQL Global Development Group
                               DisplayName     : PostgreSQL 14
                               UrlInfoAbout    : http://www.postgresql.org/
                               HelpLink        : http://www.postgresql.org/docs
                               Comments        : The PostgreSQL RDBMS, version 14, packaged by EnterpriseDB
                               Contact         :
                               VersionMajor    : 14
                               MajorVersion    : 14
                               VersionMinor    : 0
                               MinorVersion    : 0
                               UninstallString : "C:\Program Files\PostgreSQL\14\uninstall-postgresql.exe"
                               InstallLocation : C:\Program Files\PostgreSQL\14
                               NoModify        : 1
                               NoRepair        : 1
                               EstimatedSize   : 950654
                               InstallDate     : 20221010


Administrator in ~
❯ echo "SELECT Version();" | & "C:\Program Files\PostgreSQL\14\bin\psql.exe" postgresql://postgres:postgres@localhost:5432
                          version
------------------------------------------------------------
 PostgreSQL 14.5, compiled by Visual C++ build 1914, 64-bit
(1 Zeile)

It reported 14.0 even for the 14.1 I had previously installed. They just don't set the minor versions. I fear it's an issue that would have to be communicated to them as they publish the Windows installer.

@denelon
Copy link
Contributor

denelon commented Oct 10, 2022

@jantari I suspect you are correct. If they aren't updating the registry entry, we don't have another reliable way to determine what upgrades have been applied or which would apply in a winget upgrade scenario.

@jantari
Copy link
Contributor

jantari commented Oct 10, 2022

@denelon allowing to specify a file path and matching against the ProductVersion in that files' metadata could be an option.

~\Documents
❯ Get-Item "${env:ProgramFiles}\PostgreSQL\14\bin\psql.exe" | fl *

PSPath              : Microsoft.PowerShell.Core\FileSystem::C:\Program Files\PostgreSQL\14\bin\psql.exe
PSParentPath        : Microsoft.PowerShell.Core\FileSystem::C:\Program Files\PostgreSQL\14\bin
PSChildName         : psql.exe
PSDrive             : C
PSProvider          : Microsoft.PowerShell.Core\FileSystem
PSIsContainer       : False
Mode                : -a---
ModeWithoutHardLink : -a---
VersionInfo         : File:             C:\Program Files\PostgreSQL\14\bin\psql.exe
                      InternalName:
                      OriginalFilename:
                      FileVersion:      14.5
                      FileDescription:  psql - the PostgreSQL interactive terminal
                      Product:          PostgreSQL
                      ProductVersion:   14.5
                      Debug:            False
                      Patched:          False

[ ... truncated ...]

ansibles win_package module supports that as a fallback option too: https://docs.ansible.com/ansible/latest/collections/ansible/windows/win_package_module.html#parameter-creates_version

@dmdragon
Copy link
Author

Recently, PostgreSQL 15 was released, so I upgraded and uninstalled PostgreSQL 14.5.
As a result, PostgreSQL (15) no longer shows up in winget upgrade.
However, PostgreSQL 15 does not yet have a minor version, so it may recur during a minor upgrade.

PS C:\>  Get-ChildItem "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall", "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall" | Where { $_.GetValue('DisplayName') -like "*post*" }

    Hive: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall

Name                           Property
----                           --------
PostgreSQL 15                  DisplayVersion  : 15
                               Publisher       : PostgreSQL Global Development Group
                               DisplayName     : PostgreSQL 15
                               UrlInfoAbout    : http://www.postgresql.org/
                               HelpLink        : http://www.postgresql.org/docs
                               Comments        : The PostgreSQL RDBMS, version 15, packaged by EnterpriseDB
                               Contact         :
                               VersionMajor    : 15
                               MajorVersion    : 15
                               VersionMinor    : 0
                               MinorVersion    : 0
                               UninstallString : "C:\Program Files\PostgreSQL\15\uninstall-postgresql.exe"
                               InstallLocation : C:\Program Files\PostgreSQL\15
                               NoModify        : 1
                               NoRepair        : 1
                               EstimatedSize   : 953141
                               InstallDate     : 20221016

PS C:\>

@kdpuvvadi
Copy link
Contributor

i think for postgresql, different major version should have their own PackageIdentifier for e.g for v13 PostgreSQL.PostgreSQL.13 , for v12 PostgreSQL.PostgreSQL.12 and so on.

 $ winget update
Name                        Id                    Version  Available
--------------------------------------------------------------------
PostgreSQL 13               PostgreSQL.PostgreSQL 13       14.5
PostgreSQL 14               PostgreSQL.PostgreSQL 14       14.5

it would then be

 winget update
Name                        Id                         Version  Available
-------------------------------------------------------------------------
PostgreSQL 13               PostgreSQL.PostgreSQL.13   13       13.8
PostgreSQL 14               PostgreSQL.PostgreSQL.14   14       14.5

@jantari
Copy link
Contributor

jantari commented Nov 8, 2022

@kdpuvvadi no, if you want to install a specific older version then use winget install --version

@kdpuvvadi
Copy link
Contributor

What i'm saying here is a suggestion mate to the maintainers like @denelon

@MarcelStranak
Copy link

Got the same issue with the following packages:

Name                        Id                    Version Available Source
--------------------------------------------------------------------------
PostgreSQL 14               PostgreSQL.PostgreSQL 14      14.5      winget
OpenSSL (64-bit)            ShiningLight.OpenSSL  1.0.0   3.0.8     winget
MySQL Installer - Community Oracle.MySQL          1.6.4.0 8.0.31    winget

@denelon denelon added Issue-Bug It either shouldn't be doing this or needs an investigation. Area-External labels Feb 27, 2023
@denelon
Copy link
Contributor

denelon commented Feb 27, 2023

This looks like a case where the installer doesn't report the version to the registry that was upgraded.

@denelon
Copy link
Contributor

denelon commented Feb 27, 2023

WinGet looks at the "displayVersion" key used to drive the Windows Apps & Features version.

Note, it's the value below the "displayName".

@MarcelStranak
Copy link

Thanks. The manual workaround worked. Changing the values in "displayVersion" to corresponding versions, stopped the problem for now.

@Danik1601
Copy link

I looked into this and it is because the Postgres Installer that EnterpriseDB packages doesn't set the Version information in the registry / control panel correctly:

It reported 14.0 even for the 14.1 I had previously installed. They just don't set the minor versions. I fear it's an issue that would have to be communicated to them as they publish the Windows installer.

I reported it here, got an answer:
https://www.postgresql.org/message-id/18040-bd2f19c82c5110c5@postgresql.org

Copy link
Contributor

Hello @dmdragon,

This issue has been identified as requiring a fix from a third party or external repository. Since there has been no recent activity on this issue, it will be automatically closed.

Template: msftbot/noRecentActivity/areaExternal

1 similar comment
Copy link
Contributor

Hello @dmdragon,

This issue has been identified as requiring a fix from a third party or external repository. Since there has been no recent activity on this issue, it will be automatically closed.

Template: msftbot/noRecentActivity/areaExternal

@denelon denelon added this to the 1.7 Packages milestone Dec 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-External Help-Wanted This is a good candidate work item from the community. Issue-Bug It either shouldn't be doing this or needs an investigation.
Projects
None yet
Development

No branches or pull requests

6 participants