@@ -171,10 +171,9 @@ export class IndexerDBClient {
171
171
`SELECT card_url
172
172
FROM
173
173
indexed_cards as i
174
- CROSS JOIN LATERAL jsonb_array_each (i.deps) as deps_each
174
+ CROSS JOIN LATERAL jsonb_array_elements_text (i.deps) as deps_array_element
175
175
INNER JOIN realm_versions r ON i.realm_url = r.realm_url
176
- WHERE
177
- deps_each.text_value =` ,
176
+ WHERE deps_array_element =` ,
178
177
param ( cardId ) ,
179
178
'AND' ,
180
179
...realmVersionExpression ( { useWorkInProgressIndex : true } ) ,
@@ -453,13 +452,13 @@ export class IndexerDBClient {
453
452
// SELECT card_url, pristine_doc
454
453
// FROM
455
454
// indexed_cards,
456
- // CROSS JOIN LATERAL jsonb_array_each (types) as types0_each,
455
+ // CROSS JOIN LATERAL jsonb_array_elements_text (types) as types0_array_element
457
456
// -- This json_tree was derived by this handler:
458
457
// CROSS JOIN LATERAL jsonb_tree(search_doc, '$.friends') as friends1_tree
459
458
// WHERE
460
459
// ( ( is_deleted = FALSE OR is_deleted IS NULL ) )
461
460
// AND (
462
- // ( types0_each.text_value = $1 )
461
+ // ( types0_array_element = $1 )
463
462
// AND (
464
463
// ( friends1_tree.text_value = $2 )
465
464
// AND
@@ -728,7 +727,7 @@ export class IndexerDBClient {
728
727
let key = `tree_${ column } _${ path } ` ;
729
728
let { name } = tableValuedFunctions . get ( key ) ?? { } ;
730
729
if ( ! name ) {
731
- name = `${ field } ${ nonce ++ } _ ${ element . kind . split ( '-' ) . pop ( ) ! } ` ;
730
+ name = `${ field } ${ nonce ++ } _tree ` ;
732
731
let absolutePath = path === '$' ? '$' : `$.${ path } ` ;
733
732
734
733
tableValuedFunctions . set ( key , {
@@ -742,14 +741,14 @@ export class IndexerDBClient {
742
741
let key = `each_${ column } ` ;
743
742
let { name } = tableValuedFunctions . get ( key ) ?? { } ;
744
743
if ( ! name ) {
745
- name = `${ column } ${ nonce ++ } _ ${ element . kind . split ( '-' ) . pop ( ) ! } ` ;
744
+ name = `${ column } ${ nonce ++ } _array_element ` ;
746
745
747
746
tableValuedFunctions . set ( key , {
748
747
name,
749
- fn : `jsonb_array_each (${ column } ) as ${ name } ` ,
748
+ fn : `jsonb_array_elements_text (${ column } ) as ${ name } ` ,
750
749
} ) ;
751
750
}
752
- return ` ${ name } .text_value` ;
751
+ return name ;
753
752
} else {
754
753
throw assertNever ( element ) ;
755
754
}
0 commit comments