pg_format command not found

In this troubleshooting guide we learn how to fix pg_format command not found error message

Introduction

When you run more command in linux terminal / console, you get the following error message

pg_format: command not found

or when using sudo you get the following error message

sudo: pg_format: command not found

Solutions to pg_format: command not found

How To Fix pg_format: command not found in Ubuntu / Debian / Kali Linux / Raspbian

In Ubuntu pg_format is provided by pgformatter package.

pgformatter is:

This SQL formatter/beautifier supports keywords from SQL-92, SQL-99, SQL-2003, SQL-2008, SQL-2011 and PostgreSQL specifics keywords. May works with any other databases too.

pgFormatter can work as a console program or as a CGI. pg_format will automatically detect its environment and output as text or as HTML following the context.

To fix this problem, we can install more using the command below.

sudo apt-get -y install pgformatter

This command might take some time to finish depending on your machine internet connection.

You can also use apt command to install pgformatter.

sudo apt -y install pgformatter

Or if you have aptitude installed you can use the following command.

sudo aptitude install pgformatter

Summary

In this tutorial we learn how to fix pg_format command not found error in Ubuntu / Debian / Kali Linux or Raspbian distribution.