Different output from PgAdmin and from library

Issue #44 invalid
Former user created an issue

Hi, i run into strange issue. I found missing some records in my application and traced it to pg gem.

output from psql console:

{{{ avion-is=# SELECT "reservation_tariffs_view".* FROM "reservation_tariffs_view" WHERE ("reservation_tariffs_view"."reservation_id" = 5807); reservation_id | tariff_id | tariff_price | tariff_start | tariff_end | hours ----------------+-----------+--------------+--------------+------------+------- 5807 | 1 | 150 | 09:00:00 | 10:00:00 | 1 }}}

output from application: {{{ res = ActiveRecord::Base.execute sql puts res.ntuples 0 }}}

So... I use rails3 and pg 0.9.0. I have this problem on my development machine (OSX) and on our testing server (Ubuntu 9.04) on PostgreSQL 8.4.3 (testing) and 8.4.4 (development)

How should i proceed?

Comments (4)

  1. Michael Granger repo owner
    • changed status to open

    The most helpful thing would be to eliminate ActiveRecord from your test. I'd imagine it'd be something like:

      require 'pg'
      sql = %{
    	SELECT "reservation_tariffs_view".* 
    	FROM "reservation_tariffs_view" 
    	WHERE ("reservation_tariffs_view"."reservation_id" = 5807);
      db = PGconn.connect( :dbname => 'database', ... )
      res = db.exec( sql )
      puts res.ntuples

    It would also help to eliminate possible misconfiguration such as connecting to the production database when you mean to be connecting to development, etc. As it stands, there's no possible way for me to reproduce your experience, and without being able to do that, no way to figure out what the fix is.

  2. Log in to comment