Open
Description
Pagination does not work for composite keys in version 9.x (works in version 6.x)
Below are version 9 and version 6 generated code (issuer_id, parent_issuer_id, start_date and source_id are the composite keys). As you can see the criteria to add the nth page is different between the 2.
The difference in the 'where' criteria results in the application only iterating over a subset of the data in v9.x
version 9.x
SELECT "ih"."issuer_id" AS "ih_issuer_id",
"ih"."parent_issuer_id" AS "ih_parent_issuer_id",
"ih"."level" AS "ih_level",
"ih"."start_date" AS "ih_start_date",
"ih"."end_date" AS "ih_end_date",
"ih"."source_id" AS "ih_source_id"
FROM "ethos_app"."issuer_hierarchy_view" "ih"
WHERE 1 = 1
AND "ih"."start_date" <= $1
AND $2 <= "ih"."end_date"
**AND (("ih"."issuer_id" < $3 OR "ih"."issuer_id" = $4) AND
("ih"."parent_issuer_id" < $5 OR "ih"."parent_issuer_id" = $6) AND
("ih"."start_date" < $7 OR "ih"."start_date" = $8) AND ("ih"."source_id" < $9 OR "ih"."source_id" = $10))**
ORDER BY "ih"."issuer_id" DESC, "ih"."parent_issuer_id" DESC, "ih"."start_date" DESC, "ih"."source_id" DESC
LIMIT 1001 -- PARAMETERS: ["2022-09-30","2022-09-30",22080794,22080794,22080794,22080794,"2020-05-29","2020-05-29","866561ab-0973-4544-9350-8a3a413f9fee","866561ab-0973-4544-9350-8a3a413f9fee"]
version 6.x
SELECT "ih"."issuer_id" AS "ih_issuer_id",
"ih"."parent_issuer_id" AS "ih_parent_issuer_id",
"ih"."level" AS "ih_level",
"ih"."start_date" AS "ih_start_date",
"ih"."end_date" AS "ih_end_date",
"ih"."source_id" AS "ih_source_id"
FROM "ethos_app"."issuer_hierarchy_view" "ih"
WHERE 1 = 1
AND "ih"."start_date" <= $1
AND $2 <= "ih"."end_date"
**AND ("ih"."issuer_id" < $3 OR "ih"."issuer_id" = $4 AND "ih"."parent_issuer_id" < $5 OR
"ih"."issuer_id" = $6 AND "ih"."parent_issuer_id" = $7 AND "ih"."start_date" < $8 OR
"ih"."issuer_id" = $9 AND "ih"."parent_issuer_id" = $10 AND "ih"."start_date" = $11 AND "ih"."source_id" < $12)**
ORDER BY "ih"."issuer_id" DESC, "ih"."parent_issuer_id" DESC, "ih"."start_date" DESC, "ih"."source_id" DESC
LIMIT 1001 -- PARAMETERS: ["2022-09-30","2022-09-30",212311729,212311729,212311729,212311729,212311729,"2022-08-31",212311729,212311729,"2022-08-31","b55f9205-59c9-4cd8-8bfa-b9245b5858fe"]
Metadata
Metadata
Assignees
Labels
No labels