Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/pgFormatter/Beautify.pm
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@ sub tokenize_sql {
|
(?:<\%|\%>|<<\->|<\->>|<\->) # pg_trgm and some geometry operators
|
(?:\->>|\->|<\#>|\#>>|\#>|\?\&|\?\||\?|\@\?) # Vector and Json Operators
(?:\->>|\->|<\#>|\#>>|\#>|\?\&|\@\?) # Vector and Json Operators
|
(?:\#<=|\#>=|\#<>|\#<|\#=) # compares tinterval and reltime
|
Expand Down
2 changes: 1 addition & 1 deletion t/02_regress.t
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use Test::Simple tests => 90;
use Test::Simple tests => 91;
use File::Temp qw/ tempfile /;

my $pg_format = $ENV{PG_FORMAT} // './pg_format'; # set to the full path to 'pg_format' to test installed binary in /usr/bin
Expand Down
22 changes: 11 additions & 11 deletions t/pg-test-files/expected/geometry.sql
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ SELECT
FROM
POINT_TBL p1
WHERE
p1.f1 ? - point '(0,0)';
p1.f1 ?- point '(0,0)';

-- "is vertical" function
SELECT
Expand Down Expand Up @@ -276,7 +276,7 @@ SELECT
FROM
LINE_TBL
WHERE
? - s;
?- s;

-- Same as line
SELECT
Expand All @@ -296,7 +296,7 @@ FROM
LINE_TBL l1,
LINE_TBL l2
WHERE
l1.s ?| | l2.s;
l1.s ?|| l2.s;

-- Perpendicular to line
SELECT
Expand All @@ -306,7 +306,7 @@ FROM
LINE_TBL l1,
LINE_TBL l2
WHERE
l1.s ? - | l2.s;
l1.s ?-| l2.s;

-- Distance to line
SELECT
Expand Down Expand Up @@ -334,7 +334,7 @@ FROM
LINE_TBL l1,
LINE_TBL l2
WHERE
l1.s ? # l2.s;
l1.s ?# l2.s;

-- Intersect with box
SELECT
Expand All @@ -344,7 +344,7 @@ FROM
LINE_TBL l,
BOX_TBL b
WHERE
l.s ? # b.f1;
l.s ?# b.f1;

-- Intersection point with line
SELECT
Expand Down Expand Up @@ -407,7 +407,7 @@ SELECT
FROM
LSEG_TBL
WHERE
? - s;
?- s;

-- Center
SELECT
Expand Down Expand Up @@ -491,7 +491,7 @@ FROM
LSEG_TBL l1,
LSEG_TBL l2
WHERE
l1.s ?| | l2.s;
l1.s ?|| l2.s;

-- Perpendicular with line segment
SELECT
Expand All @@ -501,7 +501,7 @@ FROM
LSEG_TBL l1,
LSEG_TBL l2
WHERE
l1.s ? - | l2.s;
l1.s ?-| l2.s;

-- Distance to line
SELECT
Expand Down Expand Up @@ -538,7 +538,7 @@ FROM
LSEG_TBL l,
LINE_TBL l1
WHERE
l.s ? # l1.s;
l.s ?# l1.s;

-- Intersect with box
SELECT
Expand All @@ -548,7 +548,7 @@ FROM
LSEG_TBL l,
BOX_TBL b
WHERE
l.s ? # b.f1;
l.s ?# b.f1;

-- Intersection point with line segment
SELECT
Expand Down
4 changes: 4 additions & 0 deletions t/test-files/ex88.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-- Geometric operators starting with ? must not be split
SELECT l1.s, l2.s FROM LSEG_TBL l1, LSEG_TBL l2 WHERE l1.s ?# l2.s AND l1.s ?|| l2.s AND l1.s ?-| l2.s;
SELECT s FROM LINE_TBL WHERE ?- s AND ?| s AND p ?- point '(0,0)';
SELECT j ? 'a', j ?| ARRAY['a'], j ?& ARRAY['a'], j @? '$.a' FROM t;
29 changes: 29 additions & 0 deletions t/test-files/expected/ex88.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
-- Geometric operators starting with ? must not be split
SELECT
l1.s,
l2.s
FROM
LSEG_TBL l1,
LSEG_TBL l2
WHERE
l1.s ?# l2.s
AND l1.s ?|| l2.s
AND l1.s ?-| l2.s;

SELECT
s
FROM
LINE_TBL
WHERE
?- s
AND ?| s
AND p ?- point '(0,0)';

SELECT
j ? 'a',
j ?| ARRAY['a'],
j ?& ARRAY['a'],
j @? '$.a'
FROM
t;