PostgreSQL 9.3 Missing pg_ctl Package – How to Resolve

postgresqlpostgresql-9.3

I have installed postgresql 9.3 on ubuntu 14.04 using "apt-get install postgresql".

Everything was going well until I discovered that I do not have access to the "pg_ctl" commands. Installing the postgres-xc literally breaks postgresql server. The package links become broken. I cannot re-install and have had to revert my VM and keep working without pg_ctl.

My question is, to get access to this package, should I start from scratch or uninstall and re-install postgresql?
What should I have installed in the first place?
Alternatively, is there something wrong with my path?

(I am new to postgresql and have been tossed into it for work purposes)

Best Answer

In Debian/Ubuntu, the functionalities of pg_ctl are provided by pg_ctlcluster. Quoted from its manpage:

NAME

       pg_ctlcluster - start/stop/restart/reload a PostgreSQL cluster

SYNOPSIS

       pg_ctlcluster [options] cluster-version cluster-name action -- [pg_ctl
       options]

       where action = start|stop|restart|reload|promote

DESCRIPTION

       This program controls the postmaster server for a particular cluster.
       It essentially wraps the pg_ctl(1) command. It determines the cluster
       version and data path and calls the right version of pg_ctl with
       appropriate configuration parameters and paths.

It's not technically true that pg_ctl is not installed with postgres packaged for Debian/Ubuntu. It's actually installed in /usr/lib/postgresql/X.Y/bin, where X.Y is the postgres version. This path is intentionally not in any user's default PATH since it should never needed to be invoked directly.

The reason for this setup is that the Debian/Ubuntu packaging supports several PostgreSQL instances running in parallel, either identical or different major versions.

To learn about that, it's best to read first https://help.ubuntu.com/community/PostgreSQL , before the real PostgreSQL manual or any other non-Ubuntu documentation.

postgres-xc is a multi-master fork of PostgreSQL that shouldn't be confused with PostgreSQL itself. The hint suggesting to install it to get pg_ctl is an unfortunate nonsense, probably a machine-generated advice based on the contents of postgres-xc.