Re: Where is my app installed?

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Arbol One <ArbolOne(at)hotmail(dot)ca>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Where is my app installed?
Date: 2024-08-23 02:43:27
Message-ID: ef85322f-55fd-4540-a476-013b5b8e9662@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 8/22/24 19:21, Tom Lane wrote:
> Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> writes:
>> On 8/22/24 17:36, Arbol One wrote:
>>> After installing PostgreSQL on my Debian-12 machine, I typed 'postgres
>>> --version' and got this msg:
>>> *bash: postgres: command not found*
>>> 'psql --version', however, does work and gives me this message :
>>> *psql (PostgreSQL) 16.3 (Debian 16.3-1.pgdg120+1)*
>>> Obviously postgres is not in the path, but I don't know where the
>>> 'apt-get' installed it or why it did not add it to the path.
>
>> As to where the postgres command is:
>> ls -al /usr/lib/postgresql/16/bin/
>
> Theory 1: postgres is packaged in a "postgresql-server" package
> and the OP only installed the base (client-side) package.
>
> Theory 2: postgres is installed into some directory not in the OP's
> PATH, such as /usr/sbin. Since it's primarily used as a daemon,
> this'd be a reasonable thing for a packager to do.

Yes in:

ls -al /usr/lib/postgresql/16/bin/

>
> I'd bet a nickel on #1, though, because I've not seen too many
> packagers put postgres somewhere other than where they put psql.
> "Separate server package" is extremely common though.

Correct. The missing part is that in Debian/Ubuntu packaging when you
use psql you are actually doing:

ls -al /usr/bin/psql
lrwxrwxrwx 1 root root 37 Aug 8 07:37 /usr/bin/psql ->
../share/postgresql-common/pg_wrapper

The Debian packaging routes most things through
pg_wrapper/postgresql-common a Perl script that does the magic of
finding the correct binaries for each Postgres version.

>
> regards, tom lane

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Muhammad Usman Khan 2024-08-23 04:32:54 Re: where is postres installed?
Previous Message Tom Lane 2024-08-23 02:21:52 Re: Where is my app installed?