ERROR: invalid input syntax for type circle

From: David Zhang <david(dot)zhang(at)highgo(dot)ca>
To: pgsql-hackers(at)postgresql(dot)org, David Zhang <david(dot)zhang(at)highgo(dot)ca>
Subject: ERROR: invalid input syntax for type circle
Date: 2020-04-06 21:12:38
Message-ID: 332c47fa-d951-7574-b5cc-a8f7f7201202@highgo.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

I got an error when I was trying to insert a circle using the syntax
(the 3rd one) specified in the latest document.

https://www.postgresql.org/docs/current/datatype-geometric.html#DATATYPE-CIRCLE
< ( x , y ) , r >
( ( x , y ) , r )
  ( x , y ) , r
    x , y   , r

Here is how to reproduce it.

CREATE TABLE tbl_circle(id serial PRIMARY KEY, a circle);
INSERT INTO tbl_circle(a) VALUES('( 1 , 1 ) , 5'::circle );

ERROR:  invalid input syntax for type circle: "( 1 , 1 ) , 5"
LINE 1: INSERT INTO tbl_circle(a) VALUES('( 1 , 1 ) , 5'::circle );

I made a little change in the "circle_in" function, and then I can enter
a circle using the 3rd way.

INSERT INTO tbl_circle(a) VALUES('( 1 , 1 ) , 5'::circle );
INSERT 0 1

The fix does generate the same output as the other three ways.

INSERT INTO tbl_circle(a) VALUES( '< ( 1 , 1 ) , 5 >'::circle );
INSERT INTO tbl_circle(a) VALUES( '( ( 1 , 1 ) , 5 )'::circle );
INSERT INTO tbl_circle(a) VALUES( '1 , 1 , 5'::circle );

select * from tbl_circle;
 id |     a
----+-----------
  1 | <(1,1),5>
  2 | <(1,1),5>
  3 | <(1,1),5>
  4 | <(1,1),5>
(4 rows)

Sor far, no error found during the "make check".

The patch based on tag "REL_12_2" is attached.

--
David

Software Engineer
Highgo Software Inc. (Canada)
www.highgo.ca

Attachment Content-Type Size
circle-in-input-format-fix.patch text/plain 434 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2020-04-06 21:14:01 Re: SyncRepLock acquired exclusively in default configuration
Previous Message Tomas Vondra 2020-04-06 21:12:32 Re: [PATCH] Incremental sort (was: PoC: Partial sort)