Skip to content
⌘ NSIS Forum Archive

Not finding previous PostgreSQL installation

3 posts

annuska#

Not finding previous PostgreSQL installation

Hi all,

I'm trying to find the version of previous postgresql installation with the following code:
EnumRegKey $1 HKLM "SOFTWARE\PostgreSQL\Installations\" "0"
MessageBox MB_OK "Installation: $1"
${if} $1 != ""
ReadRegStr $PG_OLD_VERSION HKLM "SOFTWARE\PostgreSQL\Installations\$1" "Version"
.....

I have followed this example.

I have checked with Registry Editor and the entry seems to exist (HKEY_LOCAL_MACHINE\SOFTWARE\PostgreSQL\Installations\postgresql-x64-9.3).
However $1 is always empty and never enters the if.

I have also tried EnumRegKey $1 HKLM "SOFTWARE\PostgreSQL\" "0" and in this case it prints "Installations" so it seems to find the root.

Any suggestions to solve this problem?

Thanks in advance,
Anna.
Anders#
If you support 32 and 64 bit psql then you must use SetRegView to read from both registry views probably.