Thread: PostgreSQL uninstall fails

PostgreSQL uninstall fails

From
"J.V."
Date:
I have to do a lot of testing which involves uninstalling PostgreSQL
completely sometimes, but there is a lot of crud still left around after
an uninstall.

1) the installation directory with PostgreSQL droppings - I have to go
manually remove it.  I do not know why the uninstaller does not blow it
away.

2) Registry Keys - dozens and dozens of keys that confuse the next
installation
     - to test:  Install 9.0.1 then uninstall
     - Install 8.4.2 and launch pgadmin III and you will see what I mean

I do a search on every key that contains the word 'postgres' and have to
delete that manually

3) The postgres user remains on the system

Can anyone get me started on where to checkout the postgreSQL installer
code and fix it so that it is no longer broken?  I may need to ask a few
questions so if I can be put in touch with the uninstaller team, would
really like to get this fixed and go back and patch everything from 8.4
forwards so that it is fixed.

It is very time consuming for me to do 1..3 and I am sure others as well
and I want to get this fixed as soon as I can.

Regards,


J.V.

Re: PostgreSQL uninstall fails

From
John R Pierce
Date:
On 11/10/11 1:30 PM, J.V. wrote:
> Can anyone get me started on where to checkout the postgreSQL
> installer code and fix it so that it is no longer broken?  I may need
> to ask a few questions so if I can be put in touch with the
> uninstaller team, would really like to get this fixed and go back and
> patch everything from 8.4 forwards so that it is fixed.

are you talking about the MS Windows installer from EnterpriseDB?
about the only clue was the mention in passing of 'registry'.


deleting the postgresql 'data' directory and the postgres user account
should be optional.





--
john r pierce                            N 37, W 122
santa cruz ca                         mid-left coast


Re: PostgreSQL uninstall fails

From
"J.V."
Date:
yes, this is on windows.

Currently removing the data directory and the postgresql user is not optional.  It fails and does not remove those two items.

There must be 30+ registry keys still there as well. 

What I am looking to do is to delete any registry entry:
  1.     that has a data value matching the pattern '*postgres*'
  2.     that has a directory value matching the pattern '*postgres*'
  3.     that has a key name matching the pattern '*postgres*'

thanks


J.V.

On 11/10/2011 2:36 PM, John R Pierce wrote:
On 11/10/11 1:30 PM, J.V. wrote:
Can anyone get me started on where to checkout the postgreSQL installer code and fix it so that it is no longer broken?  I may need to ask a few questions so if I can be put in touch with the uninstaller team, would really like to get this fixed and go back and patch everything from 8.4 forwards so that it is fixed.

are you talking about the MS Windows installer from EnterpriseDB?   about the only clue was the mention in passing of 'registry'.


deleting the postgresql 'data' directory and the postgres user account should be optional.





Re: PostgreSQL uninstall fails

From
John R Pierce
Date:
On 11/10/11 2:18 PM, J.V. wrote:
>
> What I am looking to do is to delete any registry entry:
>
>  1.     that has a data value matching the pattern '*postgres*'
>  2.     that has a directory value matching the pattern '*postgres*'
>  3.     that has a key name matching the pattern '*postgres*'
>

these registry keys are likely under just a few reg keys, no?   should
be easy enough to write a .vbs or whatever cleanup script that just
purges these left behind.

--
john r pierce                            N 37, W 122
santa cruz ca                         mid-left coast


Re: PostgreSQL uninstall fails

From
Craig Ringer
Date:
On 11/11/2011 06:18 AM, J.V. wrote:
> yes, this is on windows.
>
> Currently removing the data directory and the postgresql user is not
> optional. It fails and does not remove those two items.
>
> There must be 30+ registry keys still there as well.
>
> What I am looking to do is to delete any registry entry:
>
>  1. that has a data value matching the pattern '*postgres*'
>  2. that has a directory value matching the pattern '*postgres*'
>  3. that has a key name matching the pattern '*postgres*'

I think that's a _bad_ idea for several reasons:

- More than one PostgreSQL version can be installed concurrently

- Other products include the name-part "postgres", such as
   "Postgres Plus" among others.

- The installer cannot tell whether any other users of the mu
   "postgres" user account remain. A PgAgent install may still
   be present even after PostgreSQL has been uninstalled, for
   example, and the user won't want it uninstalled especially
   if they're about to reinstall PostgreSQL. Also, when more than
   one Pg version is present it's hard to be certain whether the
   running uninstaller is the _last_ one on the system and should
   remove the "postgres" user account.


I don't think the usual uninstaller should behave as you describe. That
said, I do see value in a "clean" uninstall option that strips out
everything at the risk of possibly breaking parallel installs of other
products or PostgreSQL versions.

I guess in an ideal world PostgreSQL installers and uninstallers could
refcount so they knew when the last product was uninstalled. In
practice, people can't be relied on to use uninstallers properly, 3rd
party products won't manage the refcount properly, etc, and it'll land
up breaking things.

--
Craig Ringer

Re: PostgreSQL uninstall fails

From
"J.V."
Date:
So if there is only one versin of postgeSQL installed and no other
products with the name "postgres", which I am guessing is very typical
in most instances, can I change the uninstaller to delete/remove
everything that this installer installed?

If there is another instance, it would leave the common things around of
course, but uninstalling a single instance leaves a lot of droppings
around that need to be manually cleaned up.


J.V.

On 11/10/2011 8:18 PM, Craig Ringer wrote:
> On 11/11/2011 06:18 AM, J.V. wrote:
>> yes, this is on windows.
>>
>> Currently removing the data directory and the postgresql user is not
>> optional. It fails and does not remove those two items.
>>
>> There must be 30+ registry keys still there as well.
>>
>> What I am looking to do is to delete any registry entry:
>>
>>  1. that has a data value matching the pattern '*postgres*'
>>  2. that has a directory value matching the pattern '*postgres*'
>>  3. that has a key name matching the pattern '*postgres*'
>
> I think that's a _bad_ idea for several reasons:
>
> - More than one PostgreSQL version can be installed concurrently
>
> - Other products include the name-part "postgres", such as
>   "Postgres Plus" among others.
>
> - The installer cannot tell whether any other users of the mu
>   "postgres" user account remain. A PgAgent install may still
>   be present even after PostgreSQL has been uninstalled, for
>   example, and the user won't want it uninstalled especially
>   if they're about to reinstall PostgreSQL. Also, when more than
>   one Pg version is present it's hard to be certain whether the
>   running uninstaller is the _last_ one on the system and should
>   remove the "postgres" user account.
>
>
> I don't think the usual uninstaller should behave as you describe.
> That said, I do see value in a "clean" uninstall option that strips
> out everything at the risk of possibly breaking parallel installs of
> other products or PostgreSQL versions.
>
> I guess in an ideal world PostgreSQL installers and uninstallers could
> refcount so they knew when the last product was uninstalled. In
> practice, people can't be relied on to use uninstallers properly, 3rd
> party products won't manage the refcount properly, etc, and it'll land
> up breaking things.
>
> --
> Craig Ringer
>

Re: PostgreSQL uninstall fails

From
John R Pierce
Date:
On 11/22/11 2:47 PM, J.V. wrote:
> So if there is only one versin of postgeSQL installed and no other
> products with the name "postgres", which I am guessing is very typical
> in most instances, can I change the uninstaller to delete/remove
> everything that this installer installed?
>
> If there is another instance, it would leave the common things around
> of course, but uninstalling a single instance leaves a lot of
> droppings around that need to be manually cleaned up.

I think the installer should ask before doing any deleting of the
postgres service account or $PGDATA directories.



--
john r pierce                            N 37, W 122
santa cruz ca                         mid-left coast


Re: PostgreSQL uninstall fails

From
Craig Ringer
Date:
On 11/23/2011 06:47 AM, J.V. wrote:
> So if there is only one versin of postgeSQL installed and no other
> products with the name "postgres", which I am guessing is very typical
> in most instances, can I change the uninstaller to delete/remove
> everything that this installer installed?

The installer is, unfortunately, not open source, so you can't :S

That aside, the problem is with determining reliably when the product
being uninstalled is the only product still using the `postgres' user,
etc. That might sound easy, but in practice it isn't as installers can't
be trusted to register themselves in any single central place or to
unregister themselves properly on uninstall (assuming they're even
uninstalled by the user not just deleted).

> If there is another instance, it would leave the common things around of
> course, but uninstalling a single instance leaves a lot of droppings
> around that need to be manually cleaned up.

I'd like to see a "clean uninstall" command line option that'd remove
the user account, etc even if it broke things. Let the *user* judge when
a clean uninstall is appropriate, since they know what they've installed.

This can be provided as a vbs script that talked to wmi. If you were to
write a suitable script, I'm sure the EnterpriseDB folks would consider
including it in the installer and adding an option to run it on uninstall.

--
Craig Ringer