We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 65d85cc commit 9570419Copy full SHA for 9570419
grafast/dataplan-pg/src/steps/pgSelect.ts
@@ -3699,9 +3699,14 @@ function buildJoin(inJoins: readonly PgSelectPlanJoin[]) {
3699
3700
function buildSelect(selects: readonly SQL[], asArray = false) {
3701
if (asArray) {
3702
- return sql`select array[\n${sql.indent(
3703
- sql.join(selects, ",\n"),
3704
- )}\n]::text[]`;
+ if (selects.length < 1) {
+ // Cannot accumulate empty arrays
+ return sql`select array[null]::text[]`;
3705
+ } else {
3706
+ return sql`select array[\n${sql.indent(
3707
+ sql.join(selects, ",\n"),
3708
+ )}\n]::text[]`;
3709
+ }
3710
}
3711
const fragmentsWithAliases = selects.map(
3712
(frag, idx) => sql`${frag} as ${sql.identifier(String(idx))}`,
0 commit comments