puppetlabs/puppetlabs-postgresql — pull request #397 by pieterlexis (2014-03-26 14:30:46+00:00)
Title: Allow the ex- and import of postgresql::server::db

When a database should be accessed from multiple systems, exporting and importing a `postgresql::server::db` resource results in the following error on the importing server:

`err: Could not retrieve catalog from remote server: Error 400 on SERVER: Another local or imported resource exists with the type and title Postgresql::Server::Db[mydb] on node dbserver`

It is exported as follows:

```puppet
@@postgresql::server::db { "mydb":
user => 'myuser',
password => postgresql_password('myuser', 'mypassword'),
tag => 'mytag';
}
```

And imported as follows:

```puppet
Postgresql::Server::Db <<| tag == 'mytag' |>>
```

This patch allows the setting of the name of the database as a parameter to ```postgresql::server::db```, allowing it to be exported as:

```puppet
@@postgresql::server::db { "mydb from ${hostname}":
user => 'myuser',
dbname => 'mydb',
password => postgresql_password('myuser', 'mypassword'),
tag => 'mytag';
}
```

And be imported without the duplicate error.

This code doesn't contain any documentation yet, but if this code is considered for inclusion, I'll write it.