File tree Expand file tree Collapse file tree 3 files changed +18
-15
lines changed Expand file tree Collapse file tree 3 files changed +18
-15
lines changed Original file line number Diff line number Diff line change @@ -4596,8 +4596,8 @@ poly_path(PG_FUNCTION_ARGS)
4596
4596
/* circle_in - convert a string to internal form.
4597
4597
*
4598
4598
* External format: (center and radius of circle)
4599
- * "(( f8,f8)< f8>) "
4600
- * also supports quick entry style "( f8,f8,f8) "
4599
+ * "<( f8,f8), f8>"
4600
+ * also supports quick entry style "f8,f8,f8"
4601
4601
*/
4602
4602
Datum
4603
4603
circle_in (PG_FUNCTION_ARGS )
@@ -4613,16 +4613,19 @@ circle_in(PG_FUNCTION_ARGS)
4613
4613
s = str ;
4614
4614
while (isspace ((unsigned char ) * s ))
4615
4615
s ++ ;
4616
- if ((* s == LDELIM_C ) || (* s == LDELIM ))
4616
+ if (* s == LDELIM_C )
4617
+ depth ++ , s ++ ;
4618
+ else if (* s == LDELIM )
4617
4619
{
4618
- depth ++ ;
4620
+ /* If there are two left parens, consume the first one */
4619
4621
cp = (s + 1 );
4620
4622
while (isspace ((unsigned char ) * cp ))
4621
4623
cp ++ ;
4622
4624
if (* cp == LDELIM )
4623
- s = cp ;
4625
+ depth ++ , s = cp ;
4624
4626
}
4625
4627
4628
+ /* pair_decode will consume parens around the pair, if any */
4626
4629
if (!pair_decode (s , & circle -> center .x , & circle -> center .y , & s ))
4627
4630
ereport (ERROR ,
4628
4631
(errcode (ERRCODE_INVALID_TEXT_REPRESENTATION ),
Original file line number Diff line number Diff line change 3
3
--
4
4
CREATE TABLE CIRCLE_TBL (f1 circle);
5
5
INSERT INTO CIRCLE_TBL VALUES ('<(5,1),3>');
6
- INSERT INTO CIRCLE_TBL VALUES ('<( 1,2),100> ');
7
- INSERT INTO CIRCLE_TBL VALUES ('1,3,5 ');
8
- INSERT INTO CIRCLE_TBL VALUES ('((1,2),3) ');
9
- INSERT INTO CIRCLE_TBL VALUES ('<( 100, 200),10> ');
10
- INSERT INTO CIRCLE_TBL VALUES ('<( 100,1), 115> ');
6
+ INSERT INTO CIRCLE_TBL VALUES ('(( 1,2),100) ');
7
+ INSERT INTO CIRCLE_TBL VALUES (' 1 , 3 , 5 ');
8
+ INSERT INTO CIRCLE_TBL VALUES (' ( ( 1 , 2 ) , 3 ) ');
9
+ INSERT INTO CIRCLE_TBL VALUES (' ( 100 , 200 ) , 10 ');
10
+ INSERT INTO CIRCLE_TBL VALUES (' < ( 100 , 1 ) , 115 > ');
11
11
-- bad values
12
12
INSERT INTO CIRCLE_TBL VALUES ('<(-100,0),-100>');
13
13
ERROR: invalid input syntax for type circle: "<(-100,0),-100>"
Original file line number Diff line number Diff line change @@ -6,15 +6,15 @@ CREATE TABLE CIRCLE_TBL (f1 circle);
6
6
7
7
INSERT INTO CIRCLE_TBL VALUES (' <(5,1),3>' );
8
8
9
- INSERT INTO CIRCLE_TBL VALUES (' <( 1,2),100> ' );
9
+ INSERT INTO CIRCLE_TBL VALUES (' (( 1,2),100) ' );
10
10
11
- INSERT INTO CIRCLE_TBL VALUES (' 1,3,5 ' );
11
+ INSERT INTO CIRCLE_TBL VALUES (' 1 , 3 , 5 ' );
12
12
13
- INSERT INTO CIRCLE_TBL VALUES (' ((1,2),3) ' );
13
+ INSERT INTO CIRCLE_TBL VALUES (' ( ( 1 , 2 ) , 3 ) ' );
14
14
15
- INSERT INTO CIRCLE_TBL VALUES (' <( 100, 200),10> ' );
15
+ INSERT INTO CIRCLE_TBL VALUES (' ( 100 , 200 ) , 10 ' );
16
16
17
- INSERT INTO CIRCLE_TBL VALUES (' <( 100,1), 115> ' );
17
+ INSERT INTO CIRCLE_TBL VALUES (' < ( 100 , 1 ) , 115 > ' );
18
18
19
19
-- bad values
20
20
You can’t perform that action at this time.
0 commit comments