Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit 5e244c7

Browse files
committed
Adds broken test for PostgreSQL query containing WITH statement.
1 parent 8f78c56 commit 5e244c7

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/ServiceStack.OrmLite.PostgreSQL.Tests/OrmLiteSelectTests.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,5 +324,28 @@ public void Can_Select_In_for_string_value()
324324
}
325325
}
326326

327+
[Test]
328+
public void Can_Select_With_Subquery()
329+
{
330+
const int n = 5;
331+
332+
using (var db = OpenDbConnection())
333+
{
334+
db.CreateTable<ModelWithFieldsOfDifferentTypes>();
335+
336+
n.Times(x => db.Insert(ModelWithFieldsOfDifferentTypes.Create(n)));
337+
338+
var sql = @"
339+
WITH max_id AS (
340+
SELECT 3 AS three)
341+
SELECT *
342+
FROM ModelWithFieldsOfDifferentTypes
343+
WHERE id <= (SELECT three FROM max_id)";
344+
345+
var rows = db.Select<ModelWithFieldsOfDifferentTypes>(sql);
346+
347+
Assert.That(rows.Count, Is.EqualTo((3)));
348+
}
349+
}
327350
}
328351
}

0 commit comments

Comments
 (0)