Skip to content

Commit 6106317

Browse files
committed
Postgres, fix timestamp tests
1 parent c2a43cd commit 6106317

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

lib/arjdbc/postgresql/adapter.rb

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def configure_connection
121121
citext: { name: 'citext' },
122122
date: { name: 'date' },
123123
daterange: { name: 'daterange' },
124-
datetime: { name: 'timestamp' },
124+
datetime: {}, # set dynamically based on datetime_type
125125
timestamptz: { name: 'timestamptz' },
126126
decimal: { name: 'decimal' }, # :limit => 1000
127127
float: { name: 'float' },
@@ -155,14 +155,6 @@ def configure_connection
155155
xml: { name: 'xml' }
156156
}
157157

158-
def native_database_types
159-
NATIVE_DATABASE_TYPES
160-
end
161-
162-
def valid_type?(type)
163-
!native_database_types[type].nil?
164-
end
165-
166158
def set_standard_conforming_strings
167159
execute("SET standard_conforming_strings = on", "SCHEMA")
168160
end
@@ -878,6 +870,18 @@ def self.database_exists?(config)
878870
public :sql_for_insert
879871
alias :postgresql_version :database_version
880872

873+
def native_database_types # :nodoc:
874+
self.class.native_database_types
875+
end
876+
877+
def self.native_database_types # :nodoc:
878+
@native_database_types ||= begin
879+
types = NATIVE_DATABASE_TYPES.dup
880+
types[:datetime] = types[datetime_type]
881+
types
882+
end
883+
end
884+
881885
private
882886

883887
FEATURE_NOT_SUPPORTED = "0A000" # :nodoc:

0 commit comments

Comments
 (0)