explain (ANALYZE, SETTINGS ON, MEMORY ON)
SELECT
CAST(0 AS NUMERIC),
T1._DocumentTRef,
T1._DocumentRRef,
T1._Date_Time,
T1._Marked,
T1._Number,
T1._Posted,
T1._Fld33608RRef,
T1._Fld33609_TYPE,
T1._Fld33609_S,
T1._Fld33609_RRRef,
T1._Fld33610,
T1._Fld33612RRef,
T1._Fld33613,
CASE WHEN (T1._Marked = FALSE) AND (T1._Fld33611 = FALSE) THEN TRUE ELSE FALSE END,
('\010'::bytea || T1._DocumentTRef),
T1._Fld33614,
T3.Fld60606RRef,
CASE WHEN (T2._Fld39486 IS NULL) THEN CAST(0 AS NUMERIC) WHEN T2._Fld39486 = TRUE THEN CAST(1 AS NUMERIC) ELSE CAST(0 AS NUMERIC) END,
CASE WHEN T1._DocumentTRef = '\000\000\003\327'::bytea THEN T11.Fld82338_ WHEN T1._DocumentTRef = '\000\000\003\330'::bytea THEN T18.Fld82341_ WHEN T1._DocumentTRef = '\000\000\004\216'::bytea THEN T25.Fld82347_ WHEN T1._DocumentTRef = '\000\000\004\217'::bytea THEN T32.Fld82348_ ELSE CAST(NULL AS BOOLEAN) END,
CASE WHEN (T1._DocumentTRef = '\000\000\004\216'::bytea) THEN CASE WHEN T1._DocumentTRef = '\000\000\003\327'::bytea THEN T11.Fld82338_ WHEN T1._DocumentTRef = '\000\000\003\330'::bytea THEN T18.Fld82341_ WHEN T1._DocumentTRef = '\000\000\004\216'::bytea THEN T25.Fld82347_ WHEN T1._DocumentTRef = '\000\000\004\217'::bytea THEN T32.Fld82348_ ELSE CAST(NULL AS BOOLEAN) END WHEN (T1._DocumentTRef = '\000\000\004\217'::bytea) THEN CASE WHEN T1._DocumentTRef = '\000\000\003\327'::bytea THEN T11.Fld82338_ WHEN T1._DocumentTRef = '\000\000\003\330'::bytea THEN T18.Fld82341_ WHEN T1._DocumentTRef = '\000\000\004\216'::bytea THEN T25.Fld82347_ WHEN T1._DocumentTRef = '\000\000\004\217'::bytea THEN T32.Fld82348_ ELSE CAST(NULL AS BOOLEAN) END ELSE CASE WHEN T1._DocumentTRef = '\000\000\003\327'::bytea THEN T11.Fld82339_ WHEN T1._DocumentTRef = '\000\000\003\330'::bytea THEN T18.Fld82340_ ELSE CAST(NULL AS BOOLEAN) END END,
CASE WHEN T1._DocumentTRef = '\000\000\005\015'::bytea THEN T39.Fld30824_ WHEN T1._DocumentTRef = '\000\000\005\016'::bytea THEN T46.Fld31303_ ELSE CAST(NULL AS BOOLEAN) END,
CASE WHEN T1._DocumentTRef = '\000\000\005\015'::bytea THEN T39.Fld78921_ WHEN T1._DocumentTRef = '\000\000\005\016'::bytea THEN T46.Fld78922_ ELSE CAST(NULL AS BOOLEAN) END,
CAST(NULL AS BYTEA),
CAST(NULL AS BOOLEAN),
CAST(NULL AS NUMERIC),
CAST(NULL AS TIMESTAMP),
CAST(NULL AS MVARCHAR(1)),
CAST(NULL AS BYTEA),
CAST(NULL AS BYTEA),
CAST(NULL AS BYTEA),
TRUE,
CAST(0 AS NUMERIC),
T1._Fld106887RRef,
CASE WHEN T1._DocumentTRef = '\000\001a\246'::bytea THEN T53.Fld90594_ WHEN T1._DocumentTRef = '\000\000\004\250'::bytea THEN T60.Fld25824_ WHEN T1._DocumentTRef = '\000\000\004\243'::bytea THEN T67.Fld25390_ WHEN T1._DocumentTRef = '\000\000\004+'::bytea THEN T74.Fld17811_ WHEN T1._DocumentTRef = '\000\000\004\247'::bytea THEN T81.Fld25793_ WHEN T1._DocumentTRef = '\000\000\004('::bytea THEN T88.Fld17234_ WHEN T1._DocumentTRef = '\000\000\003I'::bytea THEN T95.Fld3433_ WHEN T1._DocumentTRef = '\000\000\004\026'::bytea THEN T102.Fld16234_ WHEN T1._DocumentTRef = '\000\000\004!'::bytea THEN T109.Fld16993_ WHEN T1._DocumentTRef = '\000\000\004\025'::bytea THEN T116.Fld15939_ WHEN T1._DocumentTRef = '\000\000\005\015'::bytea THEN T39.Fld30760_ WHEN T1._DocumentTRef = '\000\000\004*'::bytea THEN T123.Fld17653_ WHEN T1._DocumentTRef = '\000\000\004\235'::bytea THEN T130.Fld24765_ WHEN T1._DocumentTRef = '\000\000\004\236'::bytea THEN T137.Fld24905_ WHEN T1._DocumentTRef = '\000\000\003\334'::bytea THEN T144.Fld12406_ WHEN T1._DocumentTRef = '\000\000\005\016'::bytea THEN T46.Fld31274_ WHEN T1._DocumentTRef = '\000\000\004 '::bytea THEN T151.Fld16833_ WHEN T1._DocumentTRef = '\000\000\004,'::bytea THEN T158.Fld17995_ ELSE CAST(NULL AS TIMESTAMP) END,
FALSE,
FALSE,
FALSE,
FALSE,
FALSE,
FALSE,
FALSE,
FALSE,
FALSE,
FALSE,
FALSE,
FALSE,
FALSE,
FALSE,
FALSE,
FALSE,
FALSE,
FALSE,
FALSE,
FALSE,
FALSE,
FALSE,
FALSE,
FALSE,
FALSE,
FALSE,
FALSE,
FALSE,
FALSE,
FALSE,
FALSE
FROM _DocumentJournal33607 T1
LEFT OUTER JOIN _InfoRg39484 T2
ON (('\010'::bytea = T2._Fld39485_TYPE AND T1._DocumentTRef = T2._Fld39485_RTRef AND T1._DocumentRRef = T2._Fld39485_RRRef)) AND (T2._Fld2488 = CAST(0 AS NUMERIC))
LEFT OUTER JOIN (SELECT
T4._IDRRef AS IDRRef,
T4._Fld60606RRef AS Fld60606RRef,
T4._Fld2488 AS Fld2488_
FROM _Reference395 T4
WHERE ((EXISTS(SELECT
1 AS _c1__
FROM  tt1 T9
INNER JOIN _InfoRg39131 T10
ON T10._Fld39133RRef = T9._INVALUELISTRRef
WHERE T10._Fld2488 = CAST(0 AS NUMERIC) AND T10._Fld39132_TYPE = '\010'::bytea AND T10._Fld39132_RTRef = '\000\000\001\213'::bytea AND T10._Fld39132_RRRef = T4._IDRRef) AND (TRUE IN (TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE)))) AND (T4._Fld2488 = CAST(0 AS NUMERIC))) T3
ON T1._Fld33608RRef = T3.IDRRef
LEFT OUTER JOIN (SELECT
T12._IDRRef AS IDRRef,
T12._Fld82339 AS Fld82339_,
T12._Fld82338 AS Fld82338_,
T12._Fld2488 AS Fld2488_
FROM _Document983X1 T12
WHERE ((EXISTS(SELECT
1 AS _c1__
FROM  tt1 T16
INNER JOIN _InfoRg39131 T17
ON T17._Fld39133RRef = T16._INVALUELISTRRef
WHERE T17._Fld2488 = CAST(0 AS NUMERIC) AND T17._Fld39132_TYPE = '\010'::bytea AND T17._Fld39132_RTRef = '\000\000\003\327'::bytea AND T17._Fld39132_RRRef = T12._IDRRef) AND (TRUE IN (TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE)))) AND (T12._Fld2488 = CAST(0 AS NUMERIC))) T11
ON T1._DocumentTRef = '\000\000\003\327'::bytea AND T1._DocumentRRef = T11.IDRRef
LEFT OUTER JOIN (SELECT
T19._IDRRef AS IDRRef,
T19._Fld82341 AS Fld82341_,
T19._Fld82340 AS Fld82340_,
T19._Fld2488 AS Fld2488_
FROM _Document984X1 T19
WHERE ((EXISTS(SELECT
1 AS _c1__
FROM  tt1 T23
INNER JOIN _InfoRg39131 T24
ON T24._Fld39133RRef = T23._INVALUELISTRRef
WHERE T24._Fld2488 = CAST(0 AS NUMERIC) AND T24._Fld39132_TYPE = '\010'::bytea AND T24._Fld39132_RTRef = '\000\000\003\330'::bytea AND T24._Fld39132_RRRef = T19._IDRRef) AND (TRUE IN (TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE)))) AND (T19._Fld2488 = CAST(0 AS NUMERIC))) T18
ON T1._DocumentTRef = '\000\000\003\330'::bytea AND T1._DocumentRRef = T18.IDRRef
LEFT OUTER JOIN (SELECT
T26._IDRRef AS IDRRef,
T26._Fld82347 AS Fld82347_,
T26._Fld2488 AS Fld2488_
FROM _Document1166X1 T26
WHERE ((EXISTS(SELECT
1 AS _c1__
FROM  tt1 T30
INNER JOIN _InfoRg39131 T31
ON T31._Fld39133RRef = T30._INVALUELISTRRef
WHERE T31._Fld2488 = CAST(0 AS NUMERIC) AND T31._Fld39132_TYPE = '\010'::bytea AND T31._Fld39132_RTRef = '\000\000\004\216'::bytea AND T31._Fld39132_RRRef = T26._IDRRef) AND (TRUE IN (TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE)))) AND (T26._Fld2488 = CAST(0 AS NUMERIC))) T25
ON T1._DocumentTRef = '\000\000\004\216'::bytea AND T1._DocumentRRef = T25.IDRRef
LEFT OUTER JOIN (SELECT
T33._IDRRef AS IDRRef,
T33._Fld82348 AS Fld82348_,
T33._Fld2488 AS Fld2488_
FROM _Document1167X1 T33
WHERE ((EXISTS(SELECT
1 AS _c1__
FROM  tt1 T37
INNER JOIN _InfoRg39131 T38
ON T38._Fld39133RRef = T37._INVALUELISTRRef
WHERE T38._Fld2488 = CAST(0 AS NUMERIC) AND T38._Fld39132_TYPE = '\010'::bytea AND T38._Fld39132_RTRef = '\000\000\004\217'::bytea AND T38._Fld39132_RRRef = T33._IDRRef) AND (TRUE IN (TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE)))) AND (T33._Fld2488 = CAST(0 AS NUMERIC))) T32
ON T1._DocumentTRef = '\000\000\004\217'::bytea AND T1._DocumentRRef = T32.IDRRef
LEFT OUTER JOIN (SELECT
T40._IDRRef AS IDRRef,
T40._Fld78921 AS Fld78921_,
T40._Fld30824 AS Fld30824_,
T40._Fld30760 AS Fld30760_,
T40._Fld2488 AS Fld2488_
FROM _Document1293X1 T40
WHERE ((EXISTS(SELECT
1 AS _c1__
FROM  tt1 T44
INNER JOIN _InfoRg39131 T45
ON T45._Fld39133RRef = T44._INVALUELISTRRef
WHERE T45._Fld2488 = CAST(0 AS NUMERIC) AND T45._Fld39132_TYPE = '\010'::bytea AND T45._Fld39132_RTRef = '\000\000\005\015'::bytea AND T45._Fld39132_RRRef = T40._IDRRef) AND (TRUE IN (TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE)))) AND (T40._Fld2488 = CAST(0 AS NUMERIC))) T39
ON T1._DocumentTRef = '\000\000\005\015'::bytea AND T1._DocumentRRef = T39.IDRRef
LEFT OUTER JOIN (SELECT
T47._IDRRef AS IDRRef,
T47._Fld78922 AS Fld78922_,
T47._Fld31303 AS Fld31303_,
T47._Fld31274 AS Fld31274_,
T47._Fld2488 AS Fld2488_
FROM _Document1294X1 T47
WHERE ((EXISTS(SELECT
1 AS _c1__
FROM  tt1 T51
INNER JOIN _InfoRg39131 T52
ON T52._Fld39133RRef = T51._INVALUELISTRRef
WHERE T52._Fld2488 = CAST(0 AS NUMERIC) AND T52._Fld39132_TYPE = '\010'::bytea AND T52._Fld39132_RTRef = '\000\000\005\016'::bytea AND T52._Fld39132_RRRef = T47._IDRRef) AND (TRUE IN (TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE)))) AND (T47._Fld2488 = CAST(0 AS NUMERIC))) T46
ON T1._DocumentTRef = '\000\000\005\016'::bytea AND T1._DocumentRRef = T46.IDRRef
LEFT OUTER JOIN (SELECT
T54._IDRRef AS IDRRef,
T54._Fld90594 AS Fld90594_,
T54._Fld2488 AS Fld2488_
FROM _Document90534 T54
WHERE ((EXISTS(SELECT
1 AS _c1__
FROM  tt1 T58
INNER JOIN _InfoRg39131 T59
ON T59._Fld39133RRef = T58._INVALUELISTRRef
WHERE T59._Fld2488 = CAST(0 AS NUMERIC) AND T59._Fld39132_TYPE = '\010'::bytea AND T59._Fld39132_RTRef = '\000\001a\246'::bytea AND T59._Fld39132_RRRef = T54._IDRRef) AND (TRUE IN (TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE)))) AND (T54._Fld2488 = CAST(0 AS NUMERIC))) T53
ON T1._DocumentTRef = '\000\001a\246'::bytea AND T1._DocumentRRef = T53.IDRRef
LEFT OUTER JOIN (SELECT
T61._IDRRef AS IDRRef,
T61._Fld25824 AS Fld25824_,
T61._Fld2488 AS Fld2488_
FROM _Document1192 T61
WHERE ((EXISTS(SELECT
1 AS _c1__
FROM  tt1 T65
INNER JOIN _InfoRg39131 T66
ON T66._Fld39133RRef = T65._INVALUELISTRRef
WHERE T66._Fld2488 = CAST(0 AS NUMERIC) AND T66._Fld39132_TYPE = '\010'::bytea AND T66._Fld39132_RTRef = '\000\000\004\250'::bytea AND T66._Fld39132_RRRef = T61._IDRRef) AND (TRUE IN (TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE)))) AND (T61._Fld2488 = CAST(0 AS NUMERIC))) T60
ON T1._DocumentTRef = '\000\000\004\250'::bytea AND T1._DocumentRRef = T60.IDRRef
LEFT OUTER JOIN (SELECT
T68._IDRRef AS IDRRef,
T68._Fld25390 AS Fld25390_,
T68._Fld2488 AS Fld2488_
FROM _Document1187 T68
WHERE ((EXISTS(SELECT
1 AS _c1__
FROM  tt1 T72
INNER JOIN _InfoRg39131 T73
ON T73._Fld39133RRef = T72._INVALUELISTRRef
WHERE T73._Fld2488 = CAST(0 AS NUMERIC) AND T73._Fld39132_TYPE = '\010'::bytea AND T73._Fld39132_RTRef = '\000\000\004\243'::bytea AND T73._Fld39132_RRRef = T68._IDRRef) AND (TRUE IN (TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE)))) AND (T68._Fld2488 = CAST(0 AS NUMERIC))) T67
ON T1._DocumentTRef = '\000\000\004\243'::bytea AND T1._DocumentRRef = T67.IDRRef
LEFT OUTER JOIN (SELECT
T75._IDRRef AS IDRRef,
T75._Fld2488 AS Fld2488_,
T75._Fld17811 AS Fld17811_
FROM _Document1067 T75
WHERE ((EXISTS(SELECT
1 AS _c1__
FROM  tt1 T79
INNER JOIN _InfoRg39131 T80
ON T80._Fld39133RRef = T79._INVALUELISTRRef
WHERE T80._Fld2488 = CAST(0 AS NUMERIC) AND T80._Fld39132_TYPE = '\010'::bytea AND T80._Fld39132_RTRef = '\000\000\004+'::bytea AND T80._Fld39132_RRRef = T75._IDRRef) AND (TRUE IN (TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE)))) AND (T75._Fld2488 = CAST(0 AS NUMERIC))) T74
ON T1._DocumentTRef = '\000\000\004+'::bytea AND T1._DocumentRRef = T74.IDRRef
LEFT OUTER JOIN (SELECT
T82._IDRRef AS IDRRef,
T82._Fld25793 AS Fld25793_,
T82._Fld2488 AS Fld2488_
FROM _Document1191 T82
WHERE ((EXISTS(SELECT
1 AS _c1__
FROM  tt1 T86
INNER JOIN _InfoRg39131 T87
ON T87._Fld39133RRef = T86._INVALUELISTRRef
WHERE T87._Fld2488 = CAST(0 AS NUMERIC) AND T87._Fld39132_TYPE = '\010'::bytea AND T87._Fld39132_RTRef = '\000\000\004\247'::bytea AND T87._Fld39132_RRRef = T82._IDRRef) AND (TRUE IN (TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE)))) AND (T82._Fld2488 = CAST(0 AS NUMERIC))) T81
ON T1._DocumentTRef = '\000\000\004\247'::bytea AND T1._DocumentRRef = T81.IDRRef
LEFT OUTER JOIN (SELECT
T89._IDRRef AS IDRRef,
T89._Fld2488 AS Fld2488_,
T89._Fld17234 AS Fld17234_
FROM _Document1064 T89
WHERE ((EXISTS(SELECT
1 AS _c1__
FROM  tt1 T93
INNER JOIN _InfoRg39131 T94
ON T94._Fld39133RRef = T93._INVALUELISTRRef
WHERE T94._Fld2488 = CAST(0 AS NUMERIC) AND T94._Fld39132_TYPE = '\010'::bytea AND T94._Fld39132_RTRef = '\000\000\004('::bytea AND T94._Fld39132_RRRef = T89._IDRRef) AND (TRUE IN (TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE)))) AND (T89._Fld2488 = CAST(0 AS NUMERIC))) T88
ON T1._DocumentTRef = '\000\000\004('::bytea AND T1._DocumentRRef = T88.IDRRef
LEFT OUTER JOIN (SELECT
T96._IDRRef AS IDRRef,
T96._Fld3433 AS Fld3433_,
T96._Fld2488 AS Fld2488_
FROM _Document841 T96
WHERE ((EXISTS(SELECT
1 AS _c1__
FROM  tt1 T100
INNER JOIN _InfoRg39131 T101
ON T101._Fld39133RRef = T100._INVALUELISTRRef
WHERE T101._Fld2488 = CAST(0 AS NUMERIC) AND T101._Fld39132_TYPE = '\010'::bytea AND T101._Fld39132_RTRef = '\000\000\003I'::bytea AND T101._Fld39132_RRRef = T96._IDRRef) AND (TRUE IN (TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE)))) AND (T96._Fld2488 = CAST(0 AS NUMERIC))) T95
ON T1._DocumentTRef = '\000\000\003I'::bytea AND T1._DocumentRRef = T95.IDRRef
LEFT OUTER JOIN (SELECT
T103._IDRRef AS IDRRef,
T103._Fld2488 AS Fld2488_,
T103._Fld16234 AS Fld16234_
FROM _Document1046 T103
WHERE ((EXISTS(SELECT
1 AS _c1__
FROM  tt1 T107
INNER JOIN _InfoRg39131 T108
ON T108._Fld39133RRef = T107._INVALUELISTRRef
WHERE T108._Fld2488 = CAST(0 AS NUMERIC) AND T108._Fld39132_TYPE = '\010'::bytea AND T108._Fld39132_RTRef = '\000\000\004\026'::bytea AND T108._Fld39132_RRRef = T103._IDRRef) AND (TRUE IN (TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE)))) AND (T103._Fld2488 = CAST(0 AS NUMERIC))) T102
ON T1._DocumentTRef = '\000\000\004\026'::bytea AND T1._DocumentRRef = T102.IDRRef
LEFT OUTER JOIN (SELECT
T110._IDRRef AS IDRRef,
T110._Fld2488 AS Fld2488_,
T110._Fld16993 AS Fld16993_
FROM _Document1057 T110
WHERE ((EXISTS(SELECT
1 AS _c1__
FROM  tt1 T114
INNER JOIN _InfoRg39131 T115
ON T115._Fld39133RRef = T114._INVALUELISTRRef
WHERE T115._Fld2488 = CAST(0 AS NUMERIC) AND T115._Fld39132_TYPE = '\010'::bytea AND T115._Fld39132_RTRef = '\000\000\004!'::bytea AND T115._Fld39132_RRRef = T110._IDRRef) AND (TRUE IN (TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE)))) AND (T110._Fld2488 = CAST(0 AS NUMERIC))) T109
ON T1._DocumentTRef = '\000\000\004!'::bytea AND T1._DocumentRRef = T109.IDRRef
LEFT OUTER JOIN (SELECT
T117._IDRRef AS IDRRef,
T117._Fld2488 AS Fld2488_,
T117._Fld15939 AS Fld15939_
FROM _Document1045 T117
WHERE ((EXISTS(SELECT
1 AS _c1__
FROM  tt1 T121
INNER JOIN _InfoRg39131 T122
ON T122._Fld39133RRef = T121._INVALUELISTRRef
WHERE T122._Fld2488 = CAST(0 AS NUMERIC) AND T122._Fld39132_TYPE = '\010'::bytea AND T122._Fld39132_RTRef = '\000\000\004\025'::bytea AND T122._Fld39132_RRRef = T117._IDRRef) AND (TRUE IN (TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE)))) AND (T117._Fld2488 = CAST(0 AS NUMERIC))) T116
ON T1._DocumentTRef = '\000\000\004\025'::bytea AND T1._DocumentRRef = T116.IDRRef
LEFT OUTER JOIN (SELECT
T124._IDRRef AS IDRRef,
T124._Fld2488 AS Fld2488_,
T124._Fld17653 AS Fld17653_
FROM _Document1066 T124
WHERE ((EXISTS(SELECT
1 AS _c1__
FROM  tt1 T128
INNER JOIN _InfoRg39131 T129
ON T129._Fld39133RRef = T128._INVALUELISTRRef
WHERE T129._Fld2488 = CAST(0 AS NUMERIC) AND T129._Fld39132_TYPE = '\010'::bytea AND T129._Fld39132_RTRef = '\000\000\004*'::bytea AND T129._Fld39132_RRRef = T124._IDRRef) AND (TRUE IN (TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE)))) AND (T124._Fld2488 = CAST(0 AS NUMERIC))) T123
ON T1._DocumentTRef = '\000\000\004*'::bytea AND T1._DocumentRRef = T123.IDRRef
LEFT OUTER JOIN (SELECT
T131._IDRRef AS IDRRef,
T131._Fld2488 AS Fld2488_,
T131._Fld24765 AS Fld24765_
FROM _Document1181 T131
WHERE ((EXISTS(SELECT
1 AS _c1__
FROM  tt1 T135
INNER JOIN _InfoRg39131 T136
ON T136._Fld39133RRef = T135._INVALUELISTRRef
WHERE T136._Fld2488 = CAST(0 AS NUMERIC) AND T136._Fld39132_TYPE = '\010'::bytea AND T136._Fld39132_RTRef = '\000\000\004\235'::bytea AND T136._Fld39132_RRRef = T131._IDRRef) AND (TRUE IN (TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE)))) AND (T131._Fld2488 = CAST(0 AS NUMERIC))) T130
ON T1._DocumentTRef = '\000\000\004\235'::bytea AND T1._DocumentRRef = T130.IDRRef
LEFT OUTER JOIN (SELECT
T138._IDRRef AS IDRRef,
T138._Fld24905 AS Fld24905_,
T138._Fld2488 AS Fld2488_
FROM _Document1182 T138
WHERE ((EXISTS(SELECT
1 AS _c1__
FROM  tt1 T142
INNER JOIN _InfoRg39131 T143
ON T143._Fld39133RRef = T142._INVALUELISTRRef
WHERE T143._Fld2488 = CAST(0 AS NUMERIC) AND T143._Fld39132_TYPE = '\010'::bytea AND T143._Fld39132_RTRef = '\000\000\004\236'::bytea AND T143._Fld39132_RRRef = T138._IDRRef) AND (TRUE IN (TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE)))) AND (T138._Fld2488 = CAST(0 AS NUMERIC))) T137
ON T1._DocumentTRef = '\000\000\004\236'::bytea AND T1._DocumentRRef = T137.IDRRef
LEFT OUTER JOIN (SELECT
T145._IDRRef AS IDRRef,
T145._Fld2488 AS Fld2488_,
T145._Fld12406 AS Fld12406_
FROM _Document988X1 T145
WHERE ((EXISTS(SELECT
1 AS _c1__
FROM  tt1 T149
INNER JOIN _InfoRg39131 T150
ON T150._Fld39133RRef = T149._INVALUELISTRRef
WHERE T150._Fld2488 = CAST(0 AS NUMERIC) AND T150._Fld39132_TYPE = '\010'::bytea AND T150._Fld39132_RTRef = '\000\000\003\334'::bytea AND T150._Fld39132_RRRef = T145._IDRRef) AND (TRUE IN (TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE)))) AND (T145._Fld2488 = CAST(0 AS NUMERIC))) T144
ON T1._DocumentTRef = '\000\000\003\334'::bytea AND T1._DocumentRRef = T144.IDRRef
LEFT OUTER JOIN (SELECT
T152._IDRRef AS IDRRef,
T152._Fld2488 AS Fld2488_,
T152._Fld16833 AS Fld16833_
FROM _Document1056 T152
WHERE ((EXISTS(SELECT
1 AS _c1__
FROM  tt1 T156
INNER JOIN _InfoRg39131 T157
ON T157._Fld39133RRef = T156._INVALUELISTRRef
WHERE T157._Fld2488 = CAST(0 AS NUMERIC) AND T157._Fld39132_TYPE = '\010'::bytea AND T157._Fld39132_RTRef = '\000\000\004 '::bytea AND T157._Fld39132_RRRef = T152._IDRRef) AND (TRUE IN (TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE)))) AND (T152._Fld2488 = CAST(0 AS NUMERIC))) T151
ON T1._DocumentTRef = '\000\000\004 '::bytea AND T1._DocumentRRef = T151.IDRRef
LEFT OUTER JOIN (SELECT
T159._IDRRef AS IDRRef,
T159._Fld2488 AS Fld2488_,
T159._Fld17995 AS Fld17995_
FROM _Document1068 T159
WHERE ((EXISTS(SELECT
1 AS _c1__
FROM  tt1 T163
INNER JOIN _InfoRg39131 T164
ON T164._Fld39133RRef = T163._INVALUELISTRRef
WHERE T164._Fld2488 = CAST(0 AS NUMERIC) AND T164._Fld39132_TYPE = '\010'::bytea AND T164._Fld39132_RTRef = '\000\000\004,'::bytea AND T164._Fld39132_RRRef = T159._IDRRef) AND (TRUE IN (TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE)))) AND (T159._Fld2488 = CAST(0 AS NUMERIC))) T158
ON T1._DocumentTRef = '\000\000\004,'::bytea AND T1._DocumentRRef = T158.IDRRef
WHERE (((T1._Fld2488 = CAST(0 AS NUMERIC))) AND (EXISTS(SELECT
1 AS _c1__
FROM  tt1 T168
INNER JOIN _InfoRg39131 T169
ON T169._Fld39133RRef = T168._INVALUELISTRRef
WHERE T169._Fld2488 = CAST(0 AS NUMERIC) AND T169._Fld39132_TYPE = '\010'::bytea AND T169._Fld39132_RTRef = T1._DocumentTRef AND T169._Fld39132_RRRef = T1._DocumentRRef) AND (TRUE IN (TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE)))) AND ((T1._Fld33608RRef = '\221\226\370\321\021\006}F\021\343\374\357\017#\233$'::bytea) AND ((T1._Number < 'ТПК0-001431'::mvarchar) OR (T1._Number = 'ТПК0-001431'::mvarchar) AND ((T1._DocumentTRef < '\000\000\003\334'::bytea OR T1._DocumentTRef = '\000\000\003\334'::bytea AND T1._DocumentRRef <= '\213\010 \004\017\353\301\200\021\355}\037\375\252@\326'::bytea))))
ORDER BY (T1._Number) DESC, (T1._DocumentTRef) DESC, (T1._DocumentRRef) DESC LIMIT 1000;
