@@ -684,3 +684,105 @@ select '{"a": {"b": [1,2,3]}}'::jsonb @@ 'a.b.# && [1,2,3]';
684
684
f
685
685
(1 row)
686
686
687
+ select 'asd.# = 3'::jsquery & 'zzz = true' | 'xxx.# = zero';
688
+ ?column?
689
+ ---------------------------------------------------
690
+ (("asd".# = 3 & "zzz" = true) | "xxx".# = "zero")
691
+ (1 row)
692
+
693
+ select !'asd.# = 3'::jsquery & 'zzz = true' | !'xxx.# = zero';
694
+ ?column?
695
+ ---------------------------------------------------------
696
+ ((!("asd".# = 3) & "zzz" = true) | !("xxx".# = "zero"))
697
+ (1 row)
698
+
699
+ select '{"x":[0,1,1,2]}'::jsonb @@ 'x @> [1,0]'::jsquery;
700
+ ?column?
701
+ ----------
702
+ t
703
+ (1 row)
704
+
705
+ select '{"x":[0,1,1,2]}'::jsonb @@ 'x @> [1,0,1]'::jsquery;
706
+ ?column?
707
+ ----------
708
+ t
709
+ (1 row)
710
+
711
+ select '{"x":[0,1,1,2]}'::jsonb @@ 'x @> [1,0,3]'::jsquery;
712
+ ?column?
713
+ ----------
714
+ f
715
+ (1 row)
716
+
717
+ select '{"a": {"b": [1,2,3]}}'::jsonb @@ '*.b && [ 2 ]';
718
+ ?column?
719
+ ----------
720
+ t
721
+ (1 row)
722
+
723
+ select '{"a": {"b": [1,2,3]}}'::jsonb @@ '*.b($ && [ 2 ])';
724
+ ?column?
725
+ ----------
726
+ t
727
+ (1 row)
728
+
729
+ select '{"a": {"b": [1,2,3]}}'::jsonb @@ 'a.$.b && [ 2 ]';
730
+ ?column?
731
+ ----------
732
+ t
733
+ (1 row)
734
+
735
+ select '{"a": {"b": [1,2,3]}}'::jsonb @@ 'a.$.b ($ && [ 2 ])';
736
+ ?column?
737
+ ----------
738
+ t
739
+ (1 row)
740
+
741
+ select '[1,2,3]'::jsonb @@ '# && [2]';
742
+ ?column?
743
+ ----------
744
+ f
745
+ (1 row)
746
+
747
+ select '[1,2,3]'::jsonb @@ '#($ && [2])';
748
+ ?column?
749
+ ----------
750
+ f
751
+ (1 row)
752
+
753
+ select '[1,2,3]'::jsonb @@ '$ && [2]';
754
+ ?column?
755
+ ----------
756
+ t
757
+ (1 row)
758
+
759
+ select '[1,2,3]'::jsonb @@ '$ ($ && [2])';
760
+ ?column?
761
+ ----------
762
+ t
763
+ (1 row)
764
+
765
+ select '[1,2,3]'::jsonb @@ '$ = 2';
766
+ ?column?
767
+ ----------
768
+ f
769
+ (1 row)
770
+
771
+ select '[1,2,3]'::jsonb @@ '# = 2';
772
+ ?column?
773
+ ----------
774
+ t
775
+ (1 row)
776
+
777
+ select '[1,2,3]'::jsonb @@ '#.$ = 2';
778
+ ?column?
779
+ ----------
780
+ t
781
+ (1 row)
782
+
783
+ select '[1,2,3]'::jsonb @@ '#($ = 2)';
784
+ ?column?
785
+ ----------
786
+ t
787
+ (1 row)
788
+
0 commit comments