<commit_before>---
layout: post
title: “Hell is paved with good intentions.” #1
---

#“Hell is paved with good intentions.” - <NAME>


##Dumb idea #1 :  Unix socket directories /tmp missing from .sock

Sometimes you come across an overachiever. Someone that thinks very highly of himself but keeps on inventing new ways to shakle you.
 
Today idea #1 : let’s cut down the number of entries in the unix_socket_directories entry of postgresql.conf

Alright now, PostgreSQL might not be the smartest ever when it comes to managing .sock files for local connections.

**BUT...**

If you remove the /tmp option in postgresql.conf unix_socket_directories, you will end up with this nice message from PostgreSQL :


~~~
[postgres@noeyypjx ~]$ psql
psql: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
~~~


Well now you have to provide psql with either 

 `psql -h localhost` 

or 
`psql -h /var/run/postgresql`

depending on what you find in your unix_socket_directories.

So just keep the /tmp in your entry.

**WHY ?**

It’s the best way to keep the file /tmp is emptied on each reboot so it’s always squeaky clean.

And above all : PostgreSQL always tries to connect only using this folder by default.

Removing entries will not help security. Other things can. 


unix_socket_directories = '/var/run/postgresql, /var/postgres/test/9.6/run, /tmp
<commit_msg>Update 2017-06-13_dumbidea_1.md<commit_after>---
layout: post
title: “Hell is paved with good intentions.” #1
---

# “Hell is paved with good intentions.” - <NAME>


## Dumb idea #1 :  Unix socket directories /tmp missing from .sock

Sometimes you come across an overachiever. Someone that thinks very highly of himself but keeps on inventing new ways to shakle you.
 
Today idea #1 : let’s cut down the number of entries in the unix_socket_directories entry of postgresql.conf

Alright now, PostgreSQL might not be the smartest ever when it comes to managing .sock files for local connections.

**BUT...**

If you remove the /tmp option in postgresql.conf unix_socket_directories, you will end up with this nice message from PostgreSQL :


~~~
[postgres@noeyypjx ~]$ psql
psql: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
~~~


Well now you have to provide psql with either 

 `psql -h localhost` 

or 
`psql -h /var/run/postgresql`

depending on what you find in your unix_socket_directories.

So just keep the /tmp in your entry.

**WHY ?**

It’s the best way to keep the file /tmp is emptied on each reboot so it’s always squeaky clean.

And above all : PostgreSQL always tries to connect only using this folder by default.

Removing entries will not help security. Other things can. Keep at least /tmp. For us DBAs. Please.

`unix_socket_directories = '/var/run/postgresql, /var/postgres/test/9.6/run, /tmp`

{'fraction_non_alphanumeric': 0.07452798940046373, 'fraction_numerical': 0.008943358728055647, 'mean_word_length': 3.6676970633693973, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4308823', 'n_tokens_mistral': 945, 'n_tokens_neox': 894, 'n_words': 429}