Skip to content

Commit 9b73129

Browse files
Specify ORDER BY enumsortorder for postgres enums
Co-authored-by: Daniel Colson <[email protected]>
1 parent c2b083d commit 9b73129

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ def enum_types
459459
query = <<~SQL
460460
SELECT
461461
type.typname AS name,
462-
string_agg(enum.enumlabel, ',') AS value
462+
string_agg(enum.enumlabel, ',' ORDER BY enum.enumsortorder) AS value
463463
FROM pg_enum AS enum
464464
JOIN pg_type AS type
465465
ON (type.oid = enum.enumtypid)

0 commit comments

Comments
 (0)