I use the Bitnami LAPPstack on my Linux system to develop my apps. It’s fast, lightweight, and doesn’t get in the way messing up with my system. I start it, restart it, stop it… whenever I want.
One thing it doesn’t have, apart the XDebug extension (I wrote an article on how to get it working: Configure XDebug with Bitnami PHP Stacks on Linux Ubuntu ), is the PL/pgSQL language configured inside the postgresql DBMS. Meaning that if you try to create a stored procedure and a trigger using that language, you’re going to get an error similar to this:
ERROR: LANGUAGE "plpgsql" does NOT exist
To solve this issue, just fire up a terminal window and go inside the postgresql/bin folder of your lappstack installation (something like /path/to/lappstack/postgresql/bin) and run this command:
createlang plpgsql -h localhost -U username databasename
Note: Change the host, the username and the databasename accordingly (the username being the username that you use to connect to the database).
It will ask for a password (for that username) and then create the language. Done.
Now you can create stored procedures and triggers using the PL/pgSQL language.
I added -h localhost because I was getting the following error:
could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
So if you’re getting something similar, try adding the correct host and the correct port:
createlang plpgsql -h localhost -p 5433 -U username databasename
Hope it helps.

Do not forget to uncomment #listen_addresses = 'localhost' and #port = 5432 by removing the # in front to allow local access to the postgres
also try to edit the postgres.conf file uncomment #unix_socket_directory = ' ' and type the directory for your unix domain socket e.g unix_socket_directory = '/var/run/postgresql/' .
also #listen_addresses = 'localhost' and #port = 5432 by removing the # in front to allow local access to the postgres
It helped to mine work, thank God