postgres

postgres

[1] Engine Configuration — SQLAlchemy 0.7 Documentation ( ( 版)) <http://docs.sqlalchemy.org/en/rel_0_7/core/engines.html#database-urls>

[2] PostgreSQL: Documentation: 9.2: Database Connection Control Functions ( ( 版)) <http://www.postgresql.org/docs/9.2/static/libpq-connect.html#LIBPQ-CONNSTRING>

[3] PostgreSQL: Documentation: 9.5: Database Connection Control Functions () <https://www.postgresql.org/docs/current/static/libpq-connect.html#AEN42532>

[4] '/' is not allowed in domains · Issue #26 · servo/rust-url () <https://github.com/servo/rust-url/issues/26>

[5] Heroku Postgres | Heroku Dev Center () <https://devcenter.heroku.com/articles/heroku-postgresql>

Once Heroku Postgres has been added a DATABASE_URL or HEROKU_POSTGRESQL_COLOR_URL setting will be available in the app configuration and will contain the URL used to access the newly provisioned Heroku Postgres service. DATABASE_URL will be given to the database if it is the first one for the application, otherwise the HEROKU_POSTGRESQL_COLOR_URL will be created. This can be confirmed using the heroku config command.

$ heroku config -s | grep HEROKU_POSTGRESQL

HEROKU_POSTGRESQL_RED_URL=postgres://user3123:passkja83kd8@ec2-117-21-174-214.compute-1.amazonaws.com:6212/db982398

[6] Configuring Rails Applications — Ruby on Rails Guides () <http://edgeguides.rubyonrails.org/configuring.html>

This same information can be stored in a URL and provided via an environment variable like this:

> puts ENV['DATABASE_URL']

postgresql://localhost/blog_development?pool=5

[7] The DB-URI — TurboGears 1.0 documentation () <http://turbogears.org/1.0/docs/DbUri.html>

If your Linux or OS X installation has a standard setup and there’s a live socket at /tmp/.s.PGSQL.5432, your SQLAlchemy PostgreSQL dburi can be this simple:

postgres:///dbname

To specify the socket file for PostgreSQL, put the absolute path after the double slash:

postgres:///var/run/postgresql/test?debug=1

However, there are bugs in the DSN parser for SQLObject, so that it fails to separate the socket path from the database name. A DSN like this works around that issue:

postgres:///dbname?host=/path/to/socket