Skip to content

Commit 6ef6e1d

Browse files
author
Elvis Pranskevichus
committed
Handle unix_socket_directories GUC change in PostgreSQL 9.3
PostgreSQL replaced unix_socket_directory GUC with unix_socket_directories. Handle that in places where this GUC is used.
1 parent faedbb7 commit 6ef6e1d

3 files changed

Lines changed: 27 additions & 3 deletions

File tree

postgresql/temporal.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,17 @@ def init(self,
137137
listen_addresses = 'localhost',
138138
log_destination = 'stderr',
139139
log_min_messages = 'FATAL',
140-
unix_socket_directory = cluster.data_directory,
141140
))
141+
142+
if installation.version_info[:2] < (9, 3):
143+
cluster.settings.update(dict(
144+
unix_socket_directory = cluster.data_directory,
145+
))
146+
else:
147+
cluster.settings.update(dict(
148+
unix_socket_directories = cluster.data_directory,
149+
))
150+
142151
cluster.settings.update(dict(
143152
max_prepared_transactions = '10',
144153
))

postgresql/test/test_cluster.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,17 @@ def start_cluster(self, logfile = None):
2929

3030
def init(self, *args, **kw):
3131
self.cluster.init(*args, **kw)
32+
33+
if self.cluster.installation.version_info[:2] >= (9, 3):
34+
usd = 'unix_socket_directories'
35+
else:
36+
usd = 'unix_socket_directory'
37+
3238
self.cluster.settings.update({
3339
'max_connections' : '8',
3440
'listen_addresses' : 'localhost',
3541
'port' : '6543',
36-
'unix_socket_directory' : self.cluster.data_directory,
42+
usd : self.cluster.data_directory,
3743
})
3844

3945
def testSilentMode(self):

postgresql/test/test_connect.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,17 @@ def configure_cluster(self):
8686
listen_addresses = listen_addresses,
8787
log_destination = 'stderr',
8888
log_min_messages = 'FATAL',
89-
unix_socket_directory = self.cluster.data_directory,
9089
))
90+
91+
if self.cluster.installation.version_info[:2] < (9, 3):
92+
self.cluster.settings.update(dict(
93+
unix_socket_directory = self.cluster.data_directory,
94+
))
95+
else:
96+
self.cluster.settings.update(dict(
97+
unix_socket_directories = self.cluster.data_directory,
98+
))
99+
91100
# 8.4 turns prepared transactions off by default.
92101
if self.cluster.installation.version_info >= (8,1):
93102
self.cluster.settings.update(dict(

0 commit comments

Comments
 (0)