Permalink
Browse files

tests for postgres primary_key issue when there's no sequence (see #356)

  • Loading branch information...
1 parent c801e14 commit f2f25f281f1cf2c8c4a381f59879971d50831b2a @kares kares committed Apr 3, 2013
Showing with 13 additions and 0 deletions.
  1. +13 −0 test/db/postgres/simple_test.rb
@@ -113,6 +113,19 @@ def test_string_quoting_without_standard_conforming_strings
include ExplainSupportTestMethods if ar_version("3.1")
+ def test_primary_key
+ assert_equal 'id', connection.primary_key('entries')
+ assert_equal 'custom_id', connection.primary_key('custom_pk_names')
+ # assert_equal 'id', connection.primary_key('auto_ids')
+ end
+
+ def test_primary_key_without_sequence
+ connection.execute "CREATE TABLE uid_table (uid UUID PRIMARY KEY, name TEXT)"
+ assert_equal 'uid', connection.primary_key('uid_table')
+ ensure
+ connection.execute "DROP TABLE uid_table"
+ end
+
end
class PostgresTimestampTest < Test::Unit::TestCase

0 comments on commit f2f25f2

Please sign in to comment.