Skip to content

Commit 337b2d2

Browse files
committed
Merge branch 'primary_key_different_schemas' into merging_branch
2 parents fcf115a + ee2f95d commit 337b2d2

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

lib/arjdbc/db2/adapter.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,17 @@ def prefetch_primary_key?(table_name = nil)
328328
select_one(sql).nil?
329329
end
330330

331+
# @override
332+
def primary_keys(table)
333+
# If no schema in table name is given but present in URL parameter. Use the URL parameter one
334+
# This avoids issues if the table is present in multiple schemas
335+
if table.split(".").size == 1 && schema
336+
table = "#{schema}.#{table}"
337+
end
338+
339+
super
340+
end
341+
331342
def next_sequence_value(sequence_name)
332343
select_value("SELECT NEXT VALUE FOR #{sequence_name} FROM sysibm.sysdummy1")
333344
end

0 commit comments

Comments
 (0)