Skip to content

Commit

Permalink
Fix enum scaffolding for PG < 9.1 (#2162)
Browse files Browse the repository at this point in the history
Fixes #2160
  • Loading branch information
roji authored Dec 17, 2021
1 parent 0d227b3 commit 324d9fa
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -986,11 +986,11 @@ AND NOT EXISTS (SELECT * FROM pg_depend AS dep WHERE dep.objid = cls.oid AND dep
/// </summary>
private static HashSet<string> GetEnums(NpgsqlConnection connection, DatabaseModel databaseModel)
{
const string commandText = @"
var commandText = $@"
SELECT
nspname,
typname,
array_agg(enumlabel ORDER BY enumsortorder) AS labels
array_agg(enumlabel{(connection.PostgreSqlVersion >= new Version(9, 1) ? " ORDER BY enumsortorder" : "")}) AS labels
FROM pg_enum
JOIN pg_type ON pg_type.oid = enumtypid
JOIN pg_namespace ON pg_namespace.oid = pg_type.typnamespace
Expand Down

0 comments on commit 324d9fa

Please sign in to comment.