Commit Graph

35 Commits

Author SHA1 Message Date
Lars Kanis c76b123bf2 Don't cache the socket-IO while connection setup
The file_no of the socket IO can change while connecting.
This can happen when alternative hosts are tried,
while GSS authentication
and when falling back to unencrypted in sslmode:prefer .
Therefore expire the socket IO at each connect_poll and reset_poll call.

Caching the IO previosly led to occasional errors kind of:
  Errno::EBADF: Bad file descriptor

With the recreation of an IO object per connect_poll the fileno can change in the TcpGateScheduler when running on Windows.
I didn't dig deeper why this happens, but it fails in spec
  "with a Fiber scheduler connects several times concurrently"
and sometimes in other specs.
2022-03-09 19:58:02 +01:00
Brandon Dunne a6b0720666 These files have no shebang and should not be executable 2022-02-23 18:56:29 -05:00
Ryuta Kamizono 832a0d0e5a Fix some typos 2021-04-26 17:10:07 +09:00
Michael Granger 2a6f6ceea2 Consistency fixes for file headers/permissions.
Fixes #269.
2018-01-24 09:47:50 -08:00
Lars Kanis 33ce6709c0 Remove conditional call to PG.library_version
This was required for PostgreSQL < 9.1, which is no longer supported.
2018-01-12 09:09:57 +01:00
Lars Kanis 5d323449ec
Remove compatibility code for Ruby < 1.9.3
This leaves Rubinius compatibility in place, although it seems to
be broken since pg-0.18.0 due to undefined function rb_obj_method_arity().
2018-01-03 18:55:10 +01:00
Michael Granger 9ac182daed Fix the docs for PG::Result#cmd_tuples
Also add an example of the nicer #copy_data way of doing `COPY`.
2017-06-01 18:00:09 -07:00
Michael Granger 30e0fed07f Whitespace cleanup 2013-03-26 10:50:02 -07:00
Michael Granger 3da0401208 Add PG::Connection#socket_io to return a memoized IO for the underlying socket.
This keeps the IO in scope until the Connection is garbage-collected, preventing
Ruby from auto-closing the connection to PostgreSQL.
2013-01-30 07:49:57 -08:00
Michael Granger 23acf83ace Adding an example of how to insert array data using a prepared statement (issue #145) 2012-10-30 12:41:19 -07:00
Michael Granger 2fababb334 Adding a minimal "connection-test function" example 2012-06-17 09:18:00 -07:00
Mahlon E. Smith 1352bd9dca Move indexes across tablespaces along with their parents. Remove the
'parent table' option, as we can derive that automatically from the
pg_inherits table.
2012-06-12 11:48:39 -07:00
Mahlon E. Smith 15cb720c5f Add a pile of additional sample scripts that perform various
administrative tasks.

These have all been fairly well battle-tested and are in production use
at $DAYJOB, though they were cleaned up for addition to the Ruby-PG
repo.

See the top comments in each script for additional information, or the
--help flag on any of them for usage.

    - disk_usage_report

		Quick reporting on the heaviest disk consumers for a database.
		Nice for cronned/email reporting.

    - pg_statistics

		Continuous polled statistics for a database.  Suitable for
		graphing with gnuplot (example included.)

    - replication_monitor

		A command-line monitor for slave replication lag.  Works for
		both streaming replication and WAL shipping.  You should be able
		to use it as a base to plug into your preferred monitoring system.

    - wal_shipper

		A smart WAL file transfer script, similar to PITRTools.

    - warehouse_partitions

		An automated tablespace migrator for older, date-based
		partitioned tables.
2012-04-17 16:32:25 -07:00
Michael Granger 184a7911a5 Add a sample from <<issue 119>> 2012-04-02 10:38:15 -07:00
Michael Granger 2c45eaf0b1 Adding a minimal-testcase sample
--HG--
extra : rebase_source : ea68972c9b311c8c14071249ef960da27cf61474
2012-03-26 17:18:04 -07:00
Kashif Rasul eda01621a4 Added logic for missing cases.
--HG--
branch : issue-68
2012-03-05 21:16:18 +01:00
Michael Granger d4edc41e69 Cleaned up the sample/ directory 2012-01-24 19:12:00 -08:00
Michael Granger ec29fc0c03 Rearranging classes under the PG namespace to be a better Ruby citizen
--HG--
rename : .irbrc => .pryrc
rename : spec/pgconn_spec.rb => spec/pg/connection_spec.rb
rename : spec/pgresult_spec.rb => spec/pg/result_spec.rb
2012-01-24 17:21:30 -08:00
Michael Granger 93143e3d65 Adding an example of mixed synchronous/async API.
--HG--
rename : sample/async_api.rb => sample/async_mixed.rb
2012-01-13 11:35:16 -08:00
Michael Granger 0f96453021 Adding an example of how to use COPY asynchronously
--HG--
rename : sample/copyto.rb => sample/async_copyto.rb
2011-11-28 08:44:37 -08:00
Michael Granger 434c306749 Fixing some comments 2011-11-28 08:44:36 -08:00
Michael Granger 3dea9a8fd7 Adding an example of using a cursor with PGconn#exec 2011-10-10 12:09:20 -07:00
Michael Granger 8653368566 Made all the samples executable 2011-10-07 07:42:43 -07:00
Michael Granger b25d999b0a Added an example of PGconn#get_copy_data.
--HG--
rename : sample/copyfrom.rb => sample/copyto.rb
2011-09-16 14:07:20 -07:00
cwgem a6f37de1fc Fixing an issue with out of data properties and constants in the sample file. 2011-07-31 11:50:39 -07:00
Michael Granger f91f9120dd Added a few more comments to the results part of the async example 2011-05-18 16:44:10 -07:00
Michael Granger 1ce7e389b4 Adding an asynchronous API example 2011-05-18 16:40:36 -07:00
Michael Granger af29f7b479 Adding a sample of how to use COPY FROM 2010-09-28 09:09:11 -07:00
Michael Granger 132fb43fe6 Merged with 170:5418a1d86d91 2010-06-22 16:23:39 -07:00
Michael Granger 65f105dca1 Adding example of invalid binary data issue (refs #22), fixing EXT_SO path 2010-06-22 16:22:46 -07:00
Michael Granger 6839a05877 Modified the large-object sample script to reflect the pg library's API (refs #35) 2010-06-22 10:43:58 -07:00
Mahlon E. Smith f309fe906a Add a sample (usage example) for wait_for_notify(). 2009-12-10 10:30:49 -08:00
Mahlon E. Smith 3cb7348a2e * Small documentation fix for conn.notifies()
* Add wait_for_notify(), a method to do a blocking select() for
   a NOTIFY event.
2009-12-10 10:22:46 -08:00
Jeff Davis d8eb568bde * Corrected a comment.
* Cleaned up the sample directory somewhat. It's still out of
   date, though.

--HG--
extra : convert_revision : svn%3A992085b8-0825-40d1-94e8-bec087603414/ruby-pg/trunk%40119
2008-02-01 18:29:20 +00:00
Jeff Davis 8b61fa9d24 Split 'ruby-pg' module and 'postgres' module
into separate parts of the repository. They will be
maintained separately, and be released as separate
gems from this point forward.

One reason for this change is because we need separate
gems. If we distribute both modules as one gem, the
documentation is not properly generated due to class name
conflicts.

Another reason is to reduce confusion between the two
modules.

Also, I don't plan on making many improvements (aside
from bugfixes and portability issues) to the old
'postgres' code. I'd like to get it to a stable state,
and leave it alone. Meanwhile, the 'pg' module can be
developed on a faster timeline.

--HG--
extra : convert_revision : svn%3A992085b8-0825-40d1-94e8-bec087603414/ruby-pg/trunk%4063
2008-01-07 22:16:13 +00:00