@@ -190,6 +190,10 @@ export const selectParams = {
190
190
select :
191
191
'msgs:messages(id, ...message_details(created_at, channel!inner(id, slug, owner:users(*))))' ,
192
192
} ,
193
+ innerJoinOnNullableRelationship : {
194
+ from : 'booking' ,
195
+ select : 'id, hotel!inner(id, name)' ,
196
+ } ,
193
197
} as const
194
198
195
199
export const selectQueries = {
@@ -371,6 +375,9 @@ export const selectQueries = {
371
375
nestedQueryWithSelectiveFieldsAndInnerJoin : postgrest
372
376
. from ( selectParams . nestedQueryWithSelectiveFieldsAndInnerJoin . from )
373
377
. select ( selectParams . nestedQueryWithSelectiveFieldsAndInnerJoin . select ) ,
378
+ innerJoinOnNullableRelationship : postgrest
379
+ . from ( selectParams . innerJoinOnNullableRelationship . from )
380
+ . select ( selectParams . innerJoinOnNullableRelationship . select ) ,
374
381
} as const
375
382
376
383
test ( 'nested query with selective fields' , async ( ) => {
@@ -518,6 +525,62 @@ test('!inner relationship', async () => {
518
525
` )
519
526
} )
520
527
528
+ test ( '!inner relationship on nullable relation' , async ( ) => {
529
+ const res = await selectQueries . innerJoinOnNullableRelationship
530
+ expect ( res ) . toMatchInlineSnapshot ( `
531
+ Object {
532
+ "count": null,
533
+ "data": Array [
534
+ Object {
535
+ "hotel": Object {
536
+ "id": 1,
537
+ "name": "Sunset Resort",
538
+ },
539
+ "id": 1,
540
+ },
541
+ Object {
542
+ "hotel": Object {
543
+ "id": 1,
544
+ "name": "Sunset Resort",
545
+ },
546
+ "id": 2,
547
+ },
548
+ Object {
549
+ "hotel": Object {
550
+ "id": 2,
551
+ "name": "Mountain View Hotel",
552
+ },
553
+ "id": 3,
554
+ },
555
+ Object {
556
+ "hotel": Object {
557
+ "id": 3,
558
+ "name": "Beachfront Inn",
559
+ },
560
+ "id": 5,
561
+ },
562
+ Object {
563
+ "hotel": Object {
564
+ "id": 1,
565
+ "name": "Sunset Resort",
566
+ },
567
+ "id": 6,
568
+ },
569
+ Object {
570
+ "hotel": Object {
571
+ "id": 4,
572
+ "name": null,
573
+ },
574
+ "id": 8,
575
+ },
576
+ ],
577
+ "error": null,
578
+ "status": 200,
579
+ "statusText": "OK",
580
+ }
581
+ ` )
582
+ } )
583
+
521
584
test ( 'one-to-many relationship' , async ( ) => {
522
585
const res = await selectQueries . oneToMany . limit ( 1 ) . single ( )
523
586
expect ( res ) . toMatchInlineSnapshot ( `
0 commit comments