Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Handle schema-qualified row_types in the pg_array integration in the …

…pg_row extension (Fixes #595)

This isn't a bulletproof fix, but it does fix the issue in most
cases.  A more complete fix would handle quoting of the type
names.
  • Loading branch information...
commit 08a27f604b0fcae64360ad06ebb66852592ad22b 1 parent 52ad6b0
@jeremyevans authored
View
2  CHANGELOG
@@ -1,5 +1,7 @@
=== HEAD
+* Handle schema-qualified row_types in the pg_array integration in the pg_row extension (jeremyevans) (#595)
+
* Support default_schema when reseting primary key sequences on PostgreSQL (jeremyevans) (#596)
* Allow treating tinyint(1) unsigned columns as booleans in the mysql adapters (jeremyevans)
View
7 lib/sequel/extensions/pg_row.rb
@@ -460,7 +460,12 @@ def register_row_type(db_type, opts={})
@conversion_procs[parser.oid] = parser
if defined?(PGArray) && PGArray.respond_to?(:register) && array_oid && array_oid > 0
- PGArray.register(db_type, :oid=>array_oid, :converter=>parser, :type_procs=>@conversion_procs, :scalar_typecast=>schema_type_symbol)
+ array_type_name = if type_schema
+ "#{type_schema}.#{type_name}"
+ else
+ type_name
+ end
+ PGArray.register(array_type_name, :oid=>array_oid, :converter=>parser, :type_procs=>@conversion_procs, :scalar_typecast=>schema_type_symbol)
end
@row_types[db_type] = opts.merge(:parser=>parser)
View
4 spec/adapters/postgres_spec.rb
@@ -2566,8 +2566,8 @@ def left_item_id
column :employees, 'person[]'
end
@db.register_row_type(:address)
- @db.register_row_type(:person)
- @db.register_row_type(:company)
+ @db.register_row_type(Sequel.qualify(:public, :person))
+ @db.register_row_type(:public__company)
@native = POSTGRES_DB.adapter_scheme == :postgres
end
Please sign in to comment.
Something went wrong with that request. Please try again.