1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-01 21:31:19 +03:00
Files
postgres/src/test/regress/sql/path.sql
Michael Paquier b8da37b3ad Rework pg_input_error_message(), now renamed pg_input_error_info()
pg_input_error_info() is now a SQL function able to return a row with
more than just the error message generated for incorrect data type
inputs when these are able to handle soft failures, returning more
contents of ErrorData, as of:
- The error message (same as before).
- The error detail, if set.
- The error hint, if set.
- SQL error code.

All the regression tests that relied on pg_input_error_message() are
updated to reflect the effects of the rename.

Per discussion with Tom Lane and Andrew Dunstan.

Author: Nathan Bossart
Discussion: https://postgr.es/m/139a68e1-bd1f-a9a7-b5fe-0be9845c6311@dunslane.net
2023-02-28 08:04:13 +09:00

51 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 * FROM pg_input_error_info('[(1,2),(3)]', 'path');
SELECT pg_input_is_valid('[(1,2,6),(3,4,6)]', 'path');
SELECT * FROM pg_input_error_info('[(1,2,6),(3,4,6)]', 'path');