mirror of
https://github.com/postgres/postgres.git
synced 2026-03-13 22:28:01 -04:00
Convert box_in, circle_in, line_in, lseg_in, path_in, point_in, and poly_in to the new style. line_in still throws hard errors for overflows/underflows that can occur when the input is specified as two points rather than in the canonical "Ax + By + C = 0" style. I'm not too concerned about that: it won't be reached in normal dump/restore cases, and it's fairly debatable that such conversion should ever have been made part of a type input function in the first place. But in any case, I don't want to extend the soft error conventions into float.h without more discussion than this patch has had. Amul Sul, minor mods by me Discussion: https://postgr.es/m/CAAJ_b97KeDWUdpTKGOaFYPv0OicjOu6EW+QYWj-Ywrgj_aEy1g@mail.gmail.com
50 lines
1.3 KiB
SQL
50 lines
1.3 KiB
SQL
--
|
|
-- PATH
|
|
--
|
|
|
|
--DROP TABLE PATH_TBL;
|
|
|
|
CREATE TABLE PATH_TBL (f1 path);
|
|
|
|
INSERT INTO PATH_TBL VALUES ('[(1,2),(3,4)]');
|
|
|
|
INSERT INTO PATH_TBL VALUES (' ( ( 1 , 2 ) , ( 3 , 4 ) ) ');
|
|
|
|
INSERT INTO PATH_TBL VALUES ('[ (0,0),(3,0),(4,5),(1,6) ]');
|
|
|
|
INSERT INTO PATH_TBL VALUES ('((1,2) ,(3,4 ))');
|
|
|
|
INSERT INTO PATH_TBL VALUES ('1,2 ,3,4 ');
|
|
|
|
INSERT INTO PATH_TBL VALUES (' [1,2,3, 4] ');
|
|
|
|
INSERT INTO PATH_TBL VALUES ('((10,20))'); -- Only one point
|
|
|
|
INSERT INTO PATH_TBL VALUES ('[ 11,12,13,14 ]');
|
|
|
|
INSERT INTO PATH_TBL VALUES ('( 11,12,13,14) ');
|
|
|
|
-- bad values for parser testing
|
|
INSERT INTO PATH_TBL VALUES ('[]');
|
|
|
|
INSERT INTO PATH_TBL VALUES ('[(,2),(3,4)]');
|
|
|
|
INSERT INTO PATH_TBL VALUES ('[(1,2),(3,4)');
|
|
|
|
INSERT INTO PATH_TBL VALUES ('(1,2,3,4');
|
|
|
|
INSERT INTO PATH_TBL VALUES ('(1,2),(3,4)]');
|
|
|
|
SELECT f1 AS open_path FROM PATH_TBL WHERE isopen(f1);
|
|
|
|
SELECT f1 AS closed_path FROM PATH_TBL WHERE isclosed(f1);
|
|
|
|
SELECT pclose(f1) AS closed_path FROM PATH_TBL;
|
|
|
|
SELECT popen(f1) AS open_path FROM PATH_TBL;
|
|
|
|
-- test non-error-throwing API for some core types
|
|
SELECT pg_input_is_valid('[(1,2),(3)]', 'path');
|
|
SELECT pg_input_error_message('[(1,2),(3)]', 'path');
|
|
SELECT pg_input_is_valid('[(1,2,6),(3,4,6)]', 'path');
|
|
SELECT pg_input_error_message('[(1,2,6),(3,4,6)]', 'path');
|