Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Commit 72c5877

Browse files
R2: add test case for last_value
1 parent daea27a commit 72c5877

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

tests/src/test/java/com/trivadis/plsql/formatter/settings/tests/rules/R2_indentation.java

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1256,6 +1256,41 @@ void analytic_function() throws IOException {
12561256
assertEquals(expected, actual);
12571257
}
12581258

1259+
@Test
1260+
void last_value_order_by() throws IOException {
1261+
var sql = """
1262+
select name
1263+
,signature
1264+
,type
1265+
,object_name
1266+
,object_type
1267+
,usage
1268+
,usage_id
1269+
,line
1270+
,col
1271+
,case
1272+
when sane_fk = 'YES' then
1273+
usage_context_id
1274+
else
1275+
last_value(
1276+
case
1277+
when sane_fk = 'YES'
1278+
and usage in ('DECLARATION', 'DEFINITION', 'ASSIGNMENT', 'EXECUTE')
1279+
then
1280+
usage_id
1281+
end
1282+
) ignore nulls over (
1283+
partition by object_name, object_type
1284+
order by line, col
1285+
rows between unbounded preceding and 1 preceding
1286+
)
1287+
end as usage_context_id,
1288+
,origin_con_id
1289+
from base_ids;
1290+
""";
1291+
formatAndAssert(sql);
1292+
}
1293+
12591294
@Test
12601295
void distinct() throws IOException {
12611296
var input = """

0 commit comments

Comments
 (0)