pg version 0.16.0 has been released!
- https://bitbucket.org/ged/ruby-pg (home)
- https://github.com/ged/ruby-pg (mirror)
- http://deveiate.org/code/pg (docs)
Pg is the Ruby interface to the {PostgreSQL
RDBMS}[http://www.postgresql.org/].
It works with {PostgreSQL 8.4 and
later}[PostgreSQL: Versioning Policy].
A small example usage:
#!/usr/bin/env ruby
require ‘pg’
Output a table of current connections to the DB
conn = PG.connect( dbname: ‘sales’ )
conn.exec( “SELECT * FROM pg_stat_activity” ) do |result|
puts " PID | User | Query"
result.each do |row|
puts " %7d | %-16s | %s " %
row.values_at(‘procpid’, ‘usename’, ‘current_query’)
end
end
Changes:
== v0.16.0 [2013-07-22] Michael G. [email protected]
Bugfixes:
- Avoid warnings about uninitialized instance variables.
- Use a more standard method of adding library and include directories.
This fixes build on AIX (Github #7) and Solaris (#164). - Cancel the running query, if a thread is about to be killed (e.g. by
CTRL-C). - Fix GVL issue with wait_for_notify/notifies and notice callbacks.
- Set proper encoding on the string returned by quote_ident,
escape_literal
and escape_identifier (#163). - Use nil as PG::Error#result in case of a NULL-result from libpq
(#166). - Recalculate the timeout of conn#wait_for_notify and conn#block in case
of socket events that require re-runs of select().
Documentation fixes:
- Fix non working example for PGresult#error_field.
Enhancements:
- Add unique exception classes for each PostgreSQL error type (#5).
- Return result of the block in conn#transaction instead of nil (#158).
- Allow ‘rake compile’ and ‘rake gem’ on non mercurial repos.
- Add support for PG_DIAG_*_NAME error fields of PostgreSQL-9.3 (#161).