mapnik/mapnik — Issue #954: if postgres is down, three failed connections are reported from one layer
Author: springmeyer
Created: 2011-11-16 18:09:19+00:00
State: open

This only appears to happen when loaded via XML:

```
$ python -c "import mapnik2 as mk;m = mk.Map(1,1);mk.load_map(m,'t.xml')"
Traceback (most recent call last):
File "", line 1, in
RuntimeError: Postgis Plugin: could not connect to server: Connection refused
Is the server running on host "localhost" and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused
Is the server running on host "localhost" and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused
Is the server running on host "localhost" and accepting
TCP/IP connections on port 5432? (encountered during parsing of layer 'roads' in map 't.xml')
```

Not from a single layer contructor:

```
$ python -c "import mapnik2 as m;m.PostGIS(dbname='foo',table='foo')"
Traceback (most recent call last):
File "", line 1, in
File "/Library/Python/2.7/site-packages/mapnik2/__init__.py", line 396, in PostGIS
return CreateDatasource(keywords)
RuntimeError: Postgis Plugin: could not connect to server: Connection refused
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
```

Nothing special with my data, simply a map with one postgis layer:

```xml

roads

( select way,highway,osm_id
from planet_osm_line
where highway in ( 'motorway', 'motorway_link',
'trunk', 'trunk_link', 'primary', 'primary_link',
'secondary', 'secondary_link', 'tertiary', 'tertiary_link',
'residential', 'unclassified' )
order by z_order) as roads
osm_id

283767.63,6359204.3,712772.86,6711153.85
postgis
osm_belgium
localhost

```