Skip to content

Commit

Permalink
Fix error PG.version_string(true)
Browse files Browse the repository at this point in the history
The PG::REVISION was removed in commit eb25f07 but it was still used in this class method.

Fixes #419
  • Loading branch information
larskanis committed Jan 28, 2022
1 parent 0232b28 commit 7844548
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/pg.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ class NotAllCopyDataRetrieved < PG::Error
class NotInBlockingMode < PG::Error
end

### Get the PG library version. If +include_buildnum+ is +true+, include the build ID.
def self::version_string( include_buildnum=false )
vstring = "%s %s" % [ self.name, VERSION ]
vstring << " (build %s)" % [ REVISION[/: ([[:xdigit:]]+)/, 1] || '0' ] if include_buildnum
return vstring
# Get the PG library version.
#
# +include_buildnum+ is no longer used and any value passed will be ignored.
def self::version_string( include_buildnum=nil )
return "%s %s" % [ self.name, VERSION ]
end


Expand Down
7 changes: 7 additions & 0 deletions spec/pg_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@
expect( PG.library_version ).to be >= 90100
end

it "can format the pg version" do
expect( PG.version_string ).to be_an( String )
expect( PG.version_string ).to match(/PG \d+\.\d+\.\d+/)
expect( PG.version_string(true) ).to be_an( String )
expect( PG.version_string(true) ).to match(/PG \d+\.\d+\.\d+/)
end

it "can select which of both security libraries to initialize" do
# This setting does nothing here, because there is already a connection
# to the server, at this point in time.
Expand Down

0 comments on commit 7844548

Please sign in to comment.