1. Michael Granger
  2. ruby-pg
  3. Issues


Issue #125 resolved

Documented method PG::Connection.ping doesn't exist

Tim Ekl
created an issue

The documentation for the {{{PG::Connection}}} class at http://deveiate.org/code/pg/PG/Connection.html contains reference to a method {{{PG::Connection.ping}}}; as far as I can tell, this method doesn't actually exist in pg 0.13.2.

Environment: Mac OS X 10.7.3 (Lion), homebrew 0.9, ruby 1.9.3p194, rubygems 1.8.15

Steps to reproduce: {{{ $ gem install pg --version '= 0.13.2' [snip: gem installs OK] $ irb

require 'pg' PG::Connection.ping }}}

Expected result: method should exist (and in the test case above, throw an error for an inaccurate number of arguments)

Actual result: {{{ NoMethodError: undefined method ping' for PG::Connection:Class from (irb):2 from /usr/local/bin/irb:12:in<main>' }}}

Other info: The version assigned to this ticket is wrong; there was no 0.13.2 option when I filed. Checking the source for the gem produces no hits for anything referencing "ping" or the constants given in the docs, other than words that happen to contain "ping" as a substring:

{{{ $ grep --ignore-case --recursive --binary-files=without-match ping ChangeLog: Bumping minor version. ChangeLog: Bumping version to 0.10.1. ChangeLog: fix escaping of paths on windows (another try) ext/pg.c: * The mapping from canonical encoding names in PostgreSQL to ones in Ruby. ext/pg.c:const char * const (pg_enc_pg2ruby_mapping[][2]) = { ext/pg.c: * A cache of mapping from PostgreSQL's encoding indices to Ruby's rb_encodings. ext/pg.c: for ( i = 0; i < sizeof(pg_enc_pg2ruby_mapping)/sizeof(pg_enc_pg2ruby_mapping[0]); ++i ) { ext/pg.c: if ( strcmp(pg_encname, pg_enc_pg2ruby_mapping[i][0]) == 0 ) ext/pg.c: return rb_enc_find( pg_enc_pg2ruby_mapping[i][1] ); ext/pg.c: for (i = 0; i < sizeof(pg_enc_pg2ruby_mapping)/sizeof(pg_enc_pg2ruby_mapping[0]); ++i) { ext/pg.c: if (strcmp(rb_encname, pg_enc_pg2ruby_mapping[i][1]) == 0) { ext/pg.c: encname = pg_enc_pg2ruby_mapping[i][0]; ext/pg_connection.c: * #escape_bytea performs this operation, escaping only the minimally required spec/lib/helpers.rb: $stderr.puts "Stopping lingering database at PID %d" % [ pid ] }}}

Comments (5)

  1. Michael Granger repo owner

    Oops, you're right. The docs on deveiate.org are for the trunk version, which does have a Connection#ping.

    I've been uploading every time I commit documentation fixes, but didn't consider that that includes as-yet unreleased features.

    I guess what this really means is that I should really tag 0.14.0 and release it. Thanks for pointing this out, and for the excellent issue description.

  2. Michael Granger repo owner

    I pushed a pre-release of 0.14.0 that includes PG::Connection#ping. You can install it with `gem install pg --pre`.

    I'll close this ticket once the release version is pushed.

  3. Log in to comment