This repository was archived by the owner on Jan 2, 2026. It is now read-only.
Commit 558f344
Rafa de la Torre
Deparse Row Expression as subquery
A row expression cannot be deparsed as ROW(...) cause otherwise column
names are lost when sending the deparsed query to the remote.
RowExpr may be present in the planner tree, as the optimizer may "pull
up" aggregation subqueries and it certainly does.
In particular, ST_AsMVT may produce different results or may miss the
geom column if column names are generated as f1, f2, ..., fn.
This solves that issue by deparsing the row expression as an alias and
embedding it into a subquery.
This is the intended syntax transformation in pseudo-code:
SELECT row_expr
FROM from_clause
WHERE where_caluse
=>
SELECT alias
FROM (
SELECT row_expr_fields
FROM from_clause
WHERE where_clause
) alias1 parent a972500 commit 558f344
1 file changed
+33
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
| 106 | + | |
106 | 107 | | |
107 | 108 | | |
108 | 109 | | |
| |||
1006 | 1007 | | |
1007 | 1008 | | |
1008 | 1009 | | |
| 1010 | + | |
1009 | 1011 | | |
1010 | 1012 | | |
1011 | 1013 | | |
| |||
1132 | 1134 | | |
1133 | 1135 | | |
1134 | 1136 | | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
1135 | 1157 | | |
1136 | 1158 | | |
1137 | 1159 | | |
| |||
1142 | 1164 | | |
1143 | 1165 | | |
1144 | 1166 | | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
1145 | 1173 | | |
1146 | 1174 | | |
1147 | 1175 | | |
| |||
2376 | 2404 | | |
2377 | 2405 | | |
2378 | 2406 | | |
2379 | | - | |
2380 | | - | |
2381 | 2407 | | |
2382 | | - | |
2383 | | - | |
2384 | | - | |
2385 | | - | |
2386 | | - | |
2387 | | - | |
2388 | | - | |
2389 | | - | |
2390 | | - | |
2391 | | - | |
| 2408 | + | |
| 2409 | + | |
| 2410 | + | |
| 2411 | + | |
| 2412 | + | |
2392 | 2413 | | |
2393 | 2414 | | |
2394 | 2415 | | |
| |||
0 commit comments