chocolatey / chocolatey/choco

Installation of postgresql18 package successful with FOSS Chocolatey, but fails with Chocolatey for Business

Open
#3,833 3 comments 0 reactions 0 assignees View on GitHub
Breaking Change Bug Customer
Dominant language
C#
Stars
11.5k
Forks
960
PR merge metrics
No merged PRs in 30d

Description

### Checklist

- [x] I confirm there are no unresolved issues reported on the [Chocolatey Status page](https://status.chocolatey.org).
- [x] I have verified this is the correct repository for opening this issue.
- [x] I have verified no other issues exist related to my problem.
- [x] I have verified this is not an issue for a specific package.
- [x] I have verified this issue is not security related.
- [x] I confirm I am using **official**, and **not** unofficial, or modified, Chocolatey products.

### What You Are Seeing?

The installation of the postgresql18 package from the Chocolatey Community Repository using install arguments to change the installation directory and the data directory works when installing with FOSS Chocolatey, but fails when attempting with Chocolatey for Business (C4B).
FOSS Chocolatey errors when ensuring the directories exist, which allows the installation to proceed. C4B ensures the directories exist by creating them, but the installation fails due to a message stating that the directories already exist.

### What is Expected?

Installing `postgresql18` with install arguments should succeed with both FOSS and C4B Chocolatey.

### How Did You Get This To Happen?

1. Prepare a location for the installation directory and data directory of PostgreSQL 18. I included an additional virtual hard disk on my VM assigned as the E:\ drive for testing.
2. Install chocolatey v2.6.0. Once this has finished, I recommend snapshotting the VM to revert back to this point for expediency.
3. In an administrative PowerShell session, run `choco install postgresql18 -y --install-arguments '--prefix E:\PostgreSQL --datadir E:\PostgreSQL\18\data'`. This should install the `postgresql18` package and its nine dependencies without issue.
4. Revert to the snapshot created in Step 3.
5. License the machine and install Chocolatey Licensed Extension v7.0.0.
6. In an administrative PowerShell session, run `choco install postgresql18 -y --install-arguments '--prefix E:\PostgreSQL --datadir E:\PostgreSQL\18\data'`.The dependencies will install correctly, but the installation of the `postgresql18` package should fail after Chocolatey ensures the directories exist, and there should be a popup stating, "The chosen installation directory exists and is non-empty. Please choose a different directory."

### System Details

- Operating System: Windows Server 2025
- Windows PowerShell Version: 5.1
- Chocolatey CLI Version: 2.6.0
- Chocolatey Licensed Extension version: 7.0.0
- Chocolatey License type (Professional / Business / ?): BusinessTrial
- Terminal/Emulator: Windows PowerShell

### Installed Packages

```bash
N/A
```

### Output Log

```bash
Commands were run with `--debug` and `--trace` so the logs are verbose. I have attached them to the issue instead of trying to use them inline.

[FOSS_Postgres18_Success.log](https://github.com/user-attachments/files/24735376/FOSS_Postgres18_Success.log)
[CLE_Postgres18_Failure.log](https://github.com/user-attachments/files/24735372/CLE_Postgres18_Failure.log)
```

### Additional Context

If one were inclined, one could install FOSS Chocolatey, install `postgresql18` using the command mentioned above, and _then_ license the machine and install the Chocolatey Licensed Extension. That's really putting a customer through the paces, though.

### Related Issue

This issue was originally created [here](https://gitlab.com/chocolatey/solutions/support-issues/-/issues/151).

Contributor guide

Open the contributing guide

Research direction

Start by comparing FOSS_Postgres18_Success.log with CLE_Postgres18_Failure.log, then reproduce the documented `choco install postgresql18` command on Windows Server 2025 with and without Chocolatey Licensed Extension. Done means the postgresql18 installation succeeds with the `--prefix` and `--datadir` arguments in both FOSS Chocolatey and C4B.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, postgresql, powershell
Domain
cli, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.