>>>>> "Martin" == Martin Maciaszek <mmaciaszek / gmx.net> writes:

    Martin> While experimenting with DBI and my PostgreSQL database I
    Martin> stumbled upon this:

    Martin> irb(main):003:0> aResult = aConnection.select_all("select * from pg_class")
    Martin> DBI::InterfaceError: Unsupported Type (typeid=1034)
    Martin> from /usr/local/stow/ruby/lib/ruby/site_ruby/1.6/DBD/Pg/Pg.rb:265:in `convert'
    [...]

The column named relacl in the pg_class has a type ID of 1034.
Unfortunately, the type ID 1034 does not appear in the pg_type table
that the postgres driver uses to build the list of conversion
procedures.  I'm not sure how to handle this.

A short term workaround might be to select only the columns of type
pg_class that you are truly interested in, and omit the relacl column.

If you really need the relacl column, you could locally modify the
load_type_map method in the Pg.rb file by adding the marked line
below.

	def load_type_map
	  @type_map = Hash.new
          @coerce = DBI::SQL::BasicQuote::Coerce.new

	  res = send_sql("SELECT typname, typelem FROM pg_type")

	  res.result.each { |name, idstr|
	    @type_map[idstr.to_i] = 
            case name
            when '_bool'                     then :as_bool
	    when '_int8', '_int4', '_int2'   then :as_int
	    when '_varchar'                  then :as_str
	    when '_float4','_float8'         then :as_float
            when '_timestamp'                then :as_timestamp
            when '_date'                     then :as_date
            else                                  :as_str
	    end
	  }
	  @type_map[1034] = :as_str   #ADD THIS LINE
	end

This will return the relacl column data as strings.  

If someone more knowledgable about Postgres can tell me how to get a
complete list of type IDs, I can update the Postgres driver
appropriately (evidently using table pg_type is not sufficient).
Alternatively, the driver could just return strings for types that it
doesn't recognize.  Perhaps that is a better idea.

Thanks.  I hope this helps.

-- 
-- Jim Weirich     jweirich / one.net    http://w3.one.net/~jweirich
---------------------------------------------------------------------
"Beware of bugs in the above code; I have only proved it correct, 
not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)