@@ -345,7 +345,7 @@ def enum_types
345345 type.typname AS name,
346346 type.OID AS oid,
347347 n.nspname AS schema,
348- string_agg (enum.enumlabel, ',' ORDER BY enum.enumsortorder) AS value
348+ array_agg (enum.enumlabel ORDER BY enum.enumsortorder) AS value
349349 FROM pg_enum AS enum
350350 JOIN pg_type AS type ON (type.oid = enum.enumtypid)
351351 JOIN pg_namespace n ON type.typnamespace = n.oid
@@ -842,6 +842,15 @@ class PostgreSQLAdapter < AbstractAdapter
842842 # setting, you should immediately run <tt>bin/rails db:migrate</tt> to update the types in your schema.rb.
843843 class_attribute :datetime_type , default : :timestamp
844844
845+ ##
846+ # :singleton-method:
847+ # Toggles automatic decoding of date columns.
848+ #
849+ # ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.select_value("select '2024-01-01'::date").class #=> String
850+ # ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.decode_dates = true
851+ # ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.select_value("select '2024-01-01'::date").class #=> Date
852+ class_attribute :decode_dates , default : false
853+
845854 # Try to use as much of the built in postgres logic as possible
846855 # maybe someday we can extend the actual adapter
847856 include ActiveRecord ::ConnectionAdapters ::PostgreSQL ::ReferentialIntegrity
@@ -855,9 +864,12 @@ class PostgreSQLAdapter < AbstractAdapter
855864 include ArJdbc ::Abstract ::DatabaseStatements
856865 include ArJdbc ::Abstract ::StatementCache
857866 include ArJdbc ::Abstract ::TransactionSupport
858- include ArJdbc ::PostgreSQL
859867 include ArJdbc ::PostgreSQLConfig
860868
869+ # NOTE: after AR refactor quote_column_name became class and instance method
870+ include ArJdbc ::PostgreSQL
871+ extend ArJdbc ::PostgreSQL
872+
861873 require 'arjdbc/postgresql/oid_types'
862874 include ::ArJdbc ::PostgreSQL ::OIDTypes
863875 include ::ArJdbc ::PostgreSQL ::DatabaseStatements
0 commit comments