Skip to content

Commit 042847c

Browse files
committed
Fix obvious bug in nested selection.
1 parent 8dc3a81 commit 042847c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

graphql.sql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -305,17 +305,17 @@ BEGIN
305305
IF sub.body IS NOT NULL THEN -- TODO: Nested JSON lookups
306306
RAISE EXCEPTION 'Nested JSON lookup is as yet unimplemented';
307307
END IF;
308-
lookups := lookups || format('->%L', sub.selector);
308+
lookups := lookups || format('%I->%L', selector, sub.selector);
309309
WHEN regtype('hstore') THEN
310310
IF sub.body IS NOT NULL THEN
311311
RAISE EXCEPTION 'No fields below this level (column % is hstore)',
312312
tab, col;
313313
END IF;
314-
lookups := lookups || format('->%L', sub.selector);
314+
lookups := lookups || format('%I->%L', selector, sub.selector);
315315
ELSE
316316
--- Treat it as a field lookup in a nested record (this could also end up
317317
--- being a function call, by the way).
318-
lookups := lookups || format('.%I', sub.selector);
318+
lookups := lookups || format('%I.%I', selector, sub.selector);
319319
END CASE;
320320
labels := labels || format('%I', sub.selector);
321321
END LOOP;

0 commit comments

Comments
 (0)