Skip to content

CLI: improve trunk install handling of extension not found and version not found #873

Open
@brianpursley

Description

@brianpursley

Currently, for postgres 15, it panics. From the output, it looks like it is interpreting the error message to be the URL... Downloading from: No extension with the given name was found

Example: Postgres 15, Extension not found

$ trunk install doesnotexist
Using pg_config: /usr/lib/postgresql/15/bin/pg_config
Using pkglibdir: "/var/lib/postgresql/data/tembo/15/lib"
Using sharedir: "/var/lib/postgresql/data/tembo"
Downloading from: No extension with the given name was found
thread 'main' panicked at 'error occurred: relative URL without a base', /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/pg-trunk-0.10.5/src/main.rs:60:6
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Example: Postgres 15, Extension found, but version not found

$ trunk install pgmq --version=1.0.99
Using pg_config: /usr/lib/postgresql/15/bin/pg_config
Using pkglibdir: "/var/lib/postgresql/data/tembo/15/lib"
Using sharedir: "/var/lib/postgresql/data/tembo"
Downloading from: Version not found
thread 'main' panicked at 'error occurred: relative URL without a base', /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/pg-trunk-0.10.5/src/main.rs:60:6
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Postgres 17

The handling seems to be a little better for Postgres 17, but still maybe not ideal.

It correctly says there isn't an extension with that name, but then it prints a message about not being able to install it through the legacy endpoint (?).

Maybe that is the intended output, but as a user, I'm not quite sure what that legacy endpoint error means.

~# trunk install doesnotexist
Using pkglibdir: "/usr/lib/postgresql/17/lib"
Using sharedir: "/usr/share/postgresql/17"
Using Postgres version: 17
Failed to fetch Trunk archive from v1 API: Found no Trunk project with name doesnotexist

error: Cannot install extension for Postgres version 17 through the legacy endpoint

Similar for an extension that is found, but a version that is not found:

~# trunk install pgmq --version=1.0.99
Using pkglibdir: "/usr/lib/postgresql/17/lib"
Using sharedir: "/usr/share/postgresql/17"
Using Postgres version: 17
Failed to fetch Trunk archive from v1 API: Found no Trunk project with name pgmq and version 1.0.99

error: Cannot install extension for Postgres version 17 through the legacy endpoint

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions