mirror of
https://github.com/postgres/postgres.git
synced 2025-12-10 14:22:35 +03:00
The beos port in the source tree doesn't even compile. and even
after that dynamic loading isn't working and shared memory handling is
broken.
Attached with this message, there is a Zip file which contain :
* beos.diff = patch file generated with difforig
* beos = folder with beos support files which need to be moved in /
src/backend/port
* expected = foler with three file for message and precision
difference in regression test
* regression.diff = rule problem (need to kill the backend manualy)
* dynloader = dynloader files (they are also in the pacth files,
but there is so much modification that I have join full files)
Everything works except a problem in 'rules' Is there some problems
with rules in the current tree ? It used to works with last week tree.
Cyril VELTER
This commit is contained in:
532
src/test/regress/expected/geometry-intel-beos.out
Normal file
532
src/test/regress/expected/geometry-intel-beos.out
Normal file
@@ -0,0 +1,532 @@
|
||||
--
|
||||
-- GEOMETRY
|
||||
--
|
||||
--
|
||||
-- Points
|
||||
--
|
||||
SELECT '' AS four, center(f1) AS center
|
||||
FROM BOX_TBL;
|
||||
four | center
|
||||
------+---------
|
||||
| (1,1)
|
||||
| (2,2)
|
||||
| (2.5,3)
|
||||
| (3,3)
|
||||
(4 rows)
|
||||
|
||||
SELECT '' AS four, (@@ f1) AS center
|
||||
FROM BOX_TBL;
|
||||
four | center
|
||||
------+---------
|
||||
| (1,1)
|
||||
| (2,2)
|
||||
| (2.5,3)
|
||||
| (3,3)
|
||||
(4 rows)
|
||||
|
||||
SELECT '' AS six, point(f1) AS center
|
||||
FROM CIRCLE_TBL;
|
||||
six | center
|
||||
-----+-----------
|
||||
| (0,0)
|
||||
| (1,2)
|
||||
| (1,3)
|
||||
| (1,2)
|
||||
| (100,200)
|
||||
| (100,0)
|
||||
(6 rows)
|
||||
|
||||
SELECT '' AS six, (@@ f1) AS center
|
||||
FROM CIRCLE_TBL;
|
||||
six | center
|
||||
-----+-----------
|
||||
| (0,0)
|
||||
| (1,2)
|
||||
| (1,3)
|
||||
| (1,2)
|
||||
| (100,200)
|
||||
| (100,0)
|
||||
(6 rows)
|
||||
|
||||
SELECT '' AS two, (@@ f1) AS center
|
||||
FROM POLYGON_TBL
|
||||
WHERE (# f1) > 2;
|
||||
two | center
|
||||
-----+-------------------------------------
|
||||
| (1.33333333333333,1.33333333333333)
|
||||
| (2.33333333333333,1.33333333333333)
|
||||
(2 rows)
|
||||
|
||||
-- "is horizontal" function
|
||||
SELECT '' AS two, p1.f1
|
||||
FROM POINT_TBL p1
|
||||
WHERE ishorizontal(p1.f1, point '(0,0)');
|
||||
two | f1
|
||||
-----+---------
|
||||
| (0,0)
|
||||
| (-10,0)
|
||||
(2 rows)
|
||||
|
||||
-- "is horizontal" operator
|
||||
SELECT '' AS two, p1.f1
|
||||
FROM POINT_TBL p1
|
||||
WHERE p1.f1 ?- point '(0,0)';
|
||||
two | f1
|
||||
-----+---------
|
||||
| (0,0)
|
||||
| (-10,0)
|
||||
(2 rows)
|
||||
|
||||
-- "is vertical" function
|
||||
SELECT '' AS one, p1.f1
|
||||
FROM POINT_TBL p1
|
||||
WHERE isvertical(p1.f1, point '(5.1,34.5)');
|
||||
one | f1
|
||||
-----+------------
|
||||
| (5.1,34.5)
|
||||
(1 row)
|
||||
|
||||
-- "is vertical" operator
|
||||
SELECT '' AS one, p1.f1
|
||||
FROM POINT_TBL p1
|
||||
WHERE p1.f1 ?| point '(5.1,34.5)';
|
||||
one | f1
|
||||
-----+------------
|
||||
| (5.1,34.5)
|
||||
(1 row)
|
||||
|
||||
--
|
||||
-- Line segments
|
||||
--
|
||||
-- intersection
|
||||
SELECT '' AS count, p.f1, l.s, l.s # p.f1 AS intersection
|
||||
FROM LSEG_TBL l, POINT_TBL p;
|
||||
ERROR: Unable to identify an operator '#' for types 'lseg' and 'point'
|
||||
You will have to retype this query using an explicit cast
|
||||
-- closest point
|
||||
SELECT '' AS thirty, p.f1, l.s, p.f1 ## l.s AS closest
|
||||
FROM LSEG_TBL l, POINT_TBL p;
|
||||
thirty | f1 | s | closest
|
||||
--------+------------+-------------------------------+---------------------------------------
|
||||
| (0,0) | [(1,2),(3,4)] | (1,2)
|
||||
| (-10,0) | [(1,2),(3,4)] | (1,2)
|
||||
| (-3,4) | [(1,2),(3,4)] | (1,2)
|
||||
| (5.1,34.5) | [(1,2),(3,4)] | (3,4)
|
||||
| (-5,-12) | [(1,2),(3,4)] | (1,2)
|
||||
| (10,10) | [(1,2),(3,4)] | (3,4)
|
||||
| (0,0) | [(0,0),(6,6)] | (-0,0)
|
||||
| (-10,0) | [(0,0),(6,6)] | (0,0)
|
||||
| (-3,4) | [(0,0),(6,6)] | (0.5,0.5)
|
||||
| (5.1,34.5) | [(0,0),(6,6)] | (6,6)
|
||||
| (-5,-12) | [(0,0),(6,6)] | (0,0)
|
||||
| (10,10) | [(0,0),(6,6)] | (6,6)
|
||||
| (0,0) | [(10,-10),(-3,-4)] | (-2.04878048780488,-4.4390243902439)
|
||||
| (-10,0) | [(10,-10),(-3,-4)] | (-3,-4)
|
||||
| (-3,4) | [(10,-10),(-3,-4)] | (-3,-4)
|
||||
| (5.1,34.5) | [(10,-10),(-3,-4)] | (-3,-4)
|
||||
| (-5,-12) | [(10,-10),(-3,-4)] | (-1.60487804878049,-4.64390243902439)
|
||||
| (10,10) | [(10,-10),(-3,-4)] | (2.39024390243902,-6.48780487804878)
|
||||
| (0,0) | [(-1000000,200),(300000,-40)] | (0.0028402365895872,15.384614860264)
|
||||
| (-10,0) | [(-1000000,200),(300000,-40)] | (-9.99715942258202,15.3864610140472)
|
||||
| (-3,4) | [(-1000000,200),(300000,-40)] | (-2.99789812267519,15.3851688427303)
|
||||
| (5.1,34.5) | [(-1000000,200),(300000,-40)] | (5.09647083221496,15.3836744976925)
|
||||
| (-5,-12) | [(-1000000,200),(300000,-40)] | (-4.99494420845634,15.3855375281616)
|
||||
| (10,10) | [(-1000000,200),(300000,-40)] | (10.000993741978,15.3827690473092)
|
||||
| (0,0) | [(11,22),(33,44)] | (11,22)
|
||||
| (-10,0) | [(11,22),(33,44)] | (11,22)
|
||||
| (-3,4) | [(11,22),(33,44)] | (11,22)
|
||||
| (5.1,34.5) | [(11,22),(33,44)] | (14.3,25.3)
|
||||
| (-5,-12) | [(11,22),(33,44)] | (11,22)
|
||||
| (10,10) | [(11,22),(33,44)] | (11,22)
|
||||
(30 rows)
|
||||
|
||||
--
|
||||
-- Lines
|
||||
--
|
||||
--
|
||||
-- Boxes
|
||||
--
|
||||
SELECT '' as six, box(f1) AS box FROM CIRCLE_TBL;
|
||||
six | box
|
||||
-----+----------------------------------------------------------------------------
|
||||
| (2.12132034355964,2.12132034355964),(-2.12132034355964,-2.12132034355964)
|
||||
| (71.7106781186548,72.7106781186548),(-69.7106781186548,-68.7106781186548)
|
||||
| (4.53553390593274,6.53553390593274),(-2.53553390593274,-0.535533905932738)
|
||||
| (3.12132034355964,4.12132034355964),(-1.12132034355964,-0.121320343559643)
|
||||
| (107.071067811865,207.071067811865),(92.9289321881345,192.928932188135)
|
||||
| (170.710678118655,70.7106781186548),(29.2893218813452,-70.7106781186548)
|
||||
(6 rows)
|
||||
|
||||
-- translation
|
||||
SELECT '' AS twentyfour, b.f1 + p.f1 AS translation
|
||||
FROM BOX_TBL b, POINT_TBL p;
|
||||
twentyfour | translation
|
||||
------------+-------------------------
|
||||
| (2,2),(0,0)
|
||||
| (-8,2),(-10,0)
|
||||
| (-1,6),(-3,4)
|
||||
| (7.1,36.5),(5.1,34.5)
|
||||
| (-3,-10),(-5,-12)
|
||||
| (12,12),(10,10)
|
||||
| (3,3),(1,1)
|
||||
| (-7,3),(-9,1)
|
||||
| (0,7),(-2,5)
|
||||
| (8.1,37.5),(6.1,35.5)
|
||||
| (-2,-9),(-4,-11)
|
||||
| (13,13),(11,11)
|
||||
| (2.5,3.5),(2.5,2.5)
|
||||
| (-7.5,3.5),(-7.5,2.5)
|
||||
| (-0.5,7.5),(-0.5,6.5)
|
||||
| (7.6,38),(7.6,37)
|
||||
| (-2.5,-8.5),(-2.5,-9.5)
|
||||
| (12.5,13.5),(12.5,12.5)
|
||||
| (3,3),(3,3)
|
||||
| (-7,3),(-7,3)
|
||||
| (0,7),(0,7)
|
||||
| (8.1,37.5),(8.1,37.5)
|
||||
| (-2,-9),(-2,-9)
|
||||
| (13,13),(13,13)
|
||||
(24 rows)
|
||||
|
||||
SELECT '' AS twentyfour, b.f1 - p.f1 AS translation
|
||||
FROM BOX_TBL b, POINT_TBL p;
|
||||
twentyfour | translation
|
||||
------------+---------------------------
|
||||
| (2,2),(0,0)
|
||||
| (12,2),(10,0)
|
||||
| (5,-2),(3,-4)
|
||||
| (-3.1,-32.5),(-5.1,-34.5)
|
||||
| (7,14),(5,12)
|
||||
| (-8,-8),(-10,-10)
|
||||
| (3,3),(1,1)
|
||||
| (13,3),(11,1)
|
||||
| (6,-1),(4,-3)
|
||||
| (-2.1,-31.5),(-4.1,-33.5)
|
||||
| (8,15),(6,13)
|
||||
| (-7,-7),(-9,-9)
|
||||
| (2.5,3.5),(2.5,2.5)
|
||||
| (12.5,3.5),(12.5,2.5)
|
||||
| (5.5,-0.5),(5.5,-1.5)
|
||||
| (-2.6,-31),(-2.6,-32)
|
||||
| (7.5,15.5),(7.5,14.5)
|
||||
| (-7.5,-6.5),(-7.5,-7.5)
|
||||
| (3,3),(3,3)
|
||||
| (13,3),(13,3)
|
||||
| (6,-1),(6,-1)
|
||||
| (-2.1,-31.5),(-2.1,-31.5)
|
||||
| (8,15),(8,15)
|
||||
| (-7,-7),(-7,-7)
|
||||
(24 rows)
|
||||
|
||||
-- scaling and rotation
|
||||
SELECT '' AS twentyfour, b.f1 * p.f1 AS rotation
|
||||
FROM BOX_TBL b, POINT_TBL p;
|
||||
twentyfour | rotation
|
||||
------------+-----------------------------
|
||||
| (0,0),(0,0)
|
||||
| (-0,0),(-20,-20)
|
||||
| (-0,2),(-14,0)
|
||||
| (0,79.2),(-58.8,0)
|
||||
| (14,-0),(0,-34)
|
||||
| (0,40),(0,0)
|
||||
| (0,0),(0,0)
|
||||
| (-10,-10),(-30,-30)
|
||||
| (-7,3),(-21,1)
|
||||
| (-29.4,118.8),(-88.2,39.6)
|
||||
| (21,-17),(7,-51)
|
||||
| (0,60),(0,20)
|
||||
| (0,0),(0,0)
|
||||
| (-25,-25),(-25,-35)
|
||||
| (-17.5,2.5),(-21.5,-0.5)
|
||||
| (-73.5,104.1),(-108,99)
|
||||
| (29.5,-42.5),(17.5,-47.5)
|
||||
| (0,60),(-10,50)
|
||||
| (0,0),(0,0)
|
||||
| (-30,-30),(-30,-30)
|
||||
| (-21,3),(-21,3)
|
||||
| (-88.2,118.8),(-88.2,118.8)
|
||||
| (21,-51),(21,-51)
|
||||
| (0,60),(0,60)
|
||||
(24 rows)
|
||||
|
||||
SELECT '' AS twenty, b.f1 / p.f1 AS rotation
|
||||
FROM BOX_TBL b, POINT_TBL p
|
||||
WHERE (p.f1 <-> point '(0,0)') >= 1;
|
||||
twenty | rotation
|
||||
--------+-----------------------------------------------------------------------------------
|
||||
| (0,-0),(-0.2,-0.2)
|
||||
| (-0.1,-0.1),(-0.3,-0.3)
|
||||
| (-0.25,-0.25),(-0.25,-0.35)
|
||||
| (-0.3,-0.3),(-0.3,-0.3)
|
||||
| (0.08,-0),(0,-0.56)
|
||||
| (0.12,-0.28),(0.04,-0.84)
|
||||
| (0.26,-0.7),(0.1,-0.82)
|
||||
| (0.12,-0.84),(0.12,-0.84)
|
||||
| (0.0651176557643925,0),(0,-0.0483449262493217)
|
||||
| (0.0976764836465887,-0.0241724631246608),(0.0325588278821962,-0.0725173893739825)
|
||||
| (0.109762715208919,-0.0562379754328844),(0.0813970697054906,-0.0604311578116521)
|
||||
| (0.0976764836465887,-0.0725173893739825),(0.0976764836465887,-0.0725173893739825)
|
||||
| (-0,0.0828402366863905),(-0.201183431952663,0)
|
||||
| (-0.100591715976331,0.124260355029586),(-0.301775147928994,0.0414201183431953)
|
||||
| (-0.251479289940828,0.103550295857988),(-0.322485207100592,0.0739644970414201)
|
||||
| (-0.301775147928994,0.124260355029586),(-0.301775147928994,0.124260355029586)
|
||||
| (0.2,0),(0,0)
|
||||
| (0.3,0),(0.1,0)
|
||||
| (0.3,0.05),(0.25,0)
|
||||
| (0.3,0),(0.3,0)
|
||||
(20 rows)
|
||||
|
||||
--
|
||||
-- Paths
|
||||
--
|
||||
SET geqo TO 'off';
|
||||
SELECT '' AS eight, npoints(f1) AS npoints, f1 AS path FROM PATH_TBL;
|
||||
eight | npoints | path
|
||||
-------+---------+---------------------------
|
||||
| 2 | [(1,2),(3,4)]
|
||||
| 2 | ((1,2),(3,4))
|
||||
| 4 | [(0,0),(3,0),(4,5),(1,6)]
|
||||
| 2 | ((1,2),(3,4))
|
||||
| 2 | ((1,2),(3,4))
|
||||
| 2 | [(1,2),(3,4)]
|
||||
| 2 | [(11,12),(13,14)]
|
||||
| 2 | ((11,12),(13,14))
|
||||
(8 rows)
|
||||
|
||||
SELECT '' AS four, path(f1) FROM POLYGON_TBL;
|
||||
four | path
|
||||
------+---------------------
|
||||
| ((2,0),(2,4),(0,0))
|
||||
| ((3,1),(3,3),(1,0))
|
||||
| ((0,0))
|
||||
| ((0,1),(0,1))
|
||||
(4 rows)
|
||||
|
||||
-- translation
|
||||
SELECT '' AS eight, p1.f1 + point '(10,10)' AS dist_add
|
||||
FROM PATH_TBL p1;
|
||||
eight | dist_add
|
||||
-------+-----------------------------------
|
||||
| [(11,12),(13,14)]
|
||||
| ((11,12),(13,14))
|
||||
| [(10,10),(13,10),(14,15),(11,16)]
|
||||
| ((11,12),(13,14))
|
||||
| ((11,12),(13,14))
|
||||
| [(11,12),(13,14)]
|
||||
| [(21,22),(23,24)]
|
||||
| ((21,22),(23,24))
|
||||
(8 rows)
|
||||
|
||||
-- scaling and rotation
|
||||
SELECT '' AS eight, p1.f1 * point '(2,-1)' AS dist_mul
|
||||
FROM PATH_TBL p1;
|
||||
eight | dist_mul
|
||||
-------+------------------------------
|
||||
| [(4,3),(10,5)]
|
||||
| ((4,3),(10,5))
|
||||
| [(0,0),(6,-3),(13,6),(8,11)]
|
||||
| ((4,3),(10,5))
|
||||
| ((4,3),(10,5))
|
||||
| [(4,3),(10,5)]
|
||||
| [(34,13),(40,15)]
|
||||
| ((34,13),(40,15))
|
||||
(8 rows)
|
||||
|
||||
RESET geqo;
|
||||
--
|
||||
-- Polygons
|
||||
--
|
||||
-- containment
|
||||
SELECT '' AS twentyfour, p.f1, poly.f1, poly.f1 ~ p.f1 AS contains
|
||||
FROM POLYGON_TBL poly, POINT_TBL p;
|
||||
twentyfour | f1 | f1 | contains
|
||||
------------+------------+---------------------+----------
|
||||
| (0,0) | ((2,0),(2,4),(0,0)) | t
|
||||
| (-10,0) | ((2,0),(2,4),(0,0)) | f
|
||||
| (-3,4) | ((2,0),(2,4),(0,0)) | f
|
||||
| (5.1,34.5) | ((2,0),(2,4),(0,0)) | f
|
||||
| (-5,-12) | ((2,0),(2,4),(0,0)) | f
|
||||
| (10,10) | ((2,0),(2,4),(0,0)) | f
|
||||
| (0,0) | ((3,1),(3,3),(1,0)) | f
|
||||
| (-10,0) | ((3,1),(3,3),(1,0)) | f
|
||||
| (-3,4) | ((3,1),(3,3),(1,0)) | f
|
||||
| (5.1,34.5) | ((3,1),(3,3),(1,0)) | f
|
||||
| (-5,-12) | ((3,1),(3,3),(1,0)) | f
|
||||
| (10,10) | ((3,1),(3,3),(1,0)) | f
|
||||
| (0,0) | ((0,0)) | t
|
||||
| (-10,0) | ((0,0)) | f
|
||||
| (-3,4) | ((0,0)) | f
|
||||
| (5.1,34.5) | ((0,0)) | f
|
||||
| (-5,-12) | ((0,0)) | f
|
||||
| (10,10) | ((0,0)) | f
|
||||
| (0,0) | ((0,1),(0,1)) | f
|
||||
| (-10,0) | ((0,1),(0,1)) | f
|
||||
| (-3,4) | ((0,1),(0,1)) | f
|
||||
| (5.1,34.5) | ((0,1),(0,1)) | f
|
||||
| (-5,-12) | ((0,1),(0,1)) | f
|
||||
| (10,10) | ((0,1),(0,1)) | f
|
||||
(24 rows)
|
||||
|
||||
SELECT '' AS twentyfour, p.f1, poly.f1, p.f1 @ poly.f1 AS contained
|
||||
FROM POLYGON_TBL poly, POINT_TBL p;
|
||||
twentyfour | f1 | f1 | contained
|
||||
------------+------------+---------------------+-----------
|
||||
| (0,0) | ((2,0),(2,4),(0,0)) | t
|
||||
| (-10,0) | ((2,0),(2,4),(0,0)) | f
|
||||
| (-3,4) | ((2,0),(2,4),(0,0)) | f
|
||||
| (5.1,34.5) | ((2,0),(2,4),(0,0)) | f
|
||||
| (-5,-12) | ((2,0),(2,4),(0,0)) | f
|
||||
| (10,10) | ((2,0),(2,4),(0,0)) | f
|
||||
| (0,0) | ((3,1),(3,3),(1,0)) | f
|
||||
| (-10,0) | ((3,1),(3,3),(1,0)) | f
|
||||
| (-3,4) | ((3,1),(3,3),(1,0)) | f
|
||||
| (5.1,34.5) | ((3,1),(3,3),(1,0)) | f
|
||||
| (-5,-12) | ((3,1),(3,3),(1,0)) | f
|
||||
| (10,10) | ((3,1),(3,3),(1,0)) | f
|
||||
| (0,0) | ((0,0)) | t
|
||||
| (-10,0) | ((0,0)) | f
|
||||
| (-3,4) | ((0,0)) | f
|
||||
| (5.1,34.5) | ((0,0)) | f
|
||||
| (-5,-12) | ((0,0)) | f
|
||||
| (10,10) | ((0,0)) | f
|
||||
| (0,0) | ((0,1),(0,1)) | f
|
||||
| (-10,0) | ((0,1),(0,1)) | f
|
||||
| (-3,4) | ((0,1),(0,1)) | f
|
||||
| (5.1,34.5) | ((0,1),(0,1)) | f
|
||||
| (-5,-12) | ((0,1),(0,1)) | f
|
||||
| (10,10) | ((0,1),(0,1)) | f
|
||||
(24 rows)
|
||||
|
||||
SELECT '' AS four, npoints(f1) AS npoints, f1 AS polygon
|
||||
FROM POLYGON_TBL;
|
||||
four | npoints | polygon
|
||||
------+---------+---------------------
|
||||
| 3 | ((2,0),(2,4),(0,0))
|
||||
| 3 | ((3,1),(3,3),(1,0))
|
||||
| 1 | ((0,0))
|
||||
| 2 | ((0,1),(0,1))
|
||||
(4 rows)
|
||||
|
||||
SELECT '' AS four, polygon(f1)
|
||||
FROM BOX_TBL;
|
||||
four | polygon
|
||||
------+-------------------------------------------
|
||||
| ((0,0),(0,2),(2,2),(2,0))
|
||||
| ((1,1),(1,3),(3,3),(3,1))
|
||||
| ((2.5,2.5),(2.5,3.5),(2.5,3.5),(2.5,2.5))
|
||||
| ((3,3),(3,3),(3,3),(3,3))
|
||||
(4 rows)
|
||||
|
||||
SELECT '' AS four, polygon(f1)
|
||||
FROM PATH_TBL WHERE isclosed(f1);
|
||||
four | polygon
|
||||
------+-------------------
|
||||
| ((1,2),(3,4))
|
||||
| ((1,2),(3,4))
|
||||
| ((1,2),(3,4))
|
||||
| ((11,12),(13,14))
|
||||
(4 rows)
|
||||
|
||||
SELECT '' AS four, f1 AS open_path, polygon( pclose(f1)) AS polygon
|
||||
FROM PATH_TBL
|
||||
WHERE isopen(f1);
|
||||
four | open_path | polygon
|
||||
------+---------------------------+---------------------------
|
||||
| [(1,2),(3,4)] | ((1,2),(3,4))
|
||||
| [(0,0),(3,0),(4,5),(1,6)] | ((0,0),(3,0),(4,5),(1,6))
|
||||
| [(1,2),(3,4)] | ((1,2),(3,4))
|
||||
| [(11,12),(13,14)] | ((11,12),(13,14))
|
||||
(4 rows)
|
||||
|
||||
-- convert circles to polygons using the default number of points
|
||||
SELECT '' AS six, polygon(f1)
|
||||
FROM CIRCLE_TBL;
|
||||
six | polygon
|
||||
-----+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
| ((-3,0),(-2.59807621135332,1.5),(-1.5,2.59807621135332),(-1.83690953073357e-16,3),(1.5,2.59807621135332),(2.59807621135332,1.5),(3,3.67381906146713e-16),(2.59807621135332,-1.5),(1.5,-2.59807621135332),(5.5107285922007e-16,-3),(-1.5,-2.59807621135332),(-2.59807621135332,-1.5))
|
||||
| ((-99,2),(-85.6025403784439,52),(-49,88.6025403784439),(0.999999999999994,102),(51,88.6025403784439),(87.6025403784439,52),(101,2.00000000000001),(87.6025403784439,-48),(51,-84.6025403784438),(1.00000000000002,-98),(-49,-84.6025403784439),(-85.6025403784438,-48))
|
||||
| ((-4,3),(-3.33012701892219,5.5),(-1.5,7.33012701892219),(1,8),(3.5,7.33012701892219),(5.33012701892219,5.5),(6,3),(5.33012701892219,0.500000000000001),(3.5,-1.33012701892219),(1,-2),(-1.5,-1.33012701892219),(-3.33012701892219,0.499999999999998))
|
||||
| ((-2,2),(-1.59807621135332,3.5),(-0.5,4.59807621135332),(1,5),(2.5,4.59807621135332),(3.59807621135332,3.5),(4,2),(3.59807621135332,0.500000000000001),(2.5,-0.598076211353315),(1,-1),(-0.5,-0.598076211353316),(-1.59807621135332,0.499999999999999))
|
||||
| ((90,200),(91.3397459621556,205),(95,208.660254037844),(100,210),(105,208.660254037844),(108.660254037844,205),(110,200),(108.660254037844,195),(105,191.339745962156),(100,190),(95,191.339745962156),(91.3397459621556,195))
|
||||
| ((0,0),(13.3974596215561,50),(50,86.6025403784439),(100,100),(150,86.6025403784439),(186.602540378444,50),(200,1.22460635382238e-14),(186.602540378444,-50),(150,-86.6025403784438),(100,-100),(50,-86.6025403784439),(13.3974596215562,-50))
|
||||
(6 rows)
|
||||
|
||||
-- convert the circle to an 8-point polygon
|
||||
SELECT '' AS six, polygon(8, f1)
|
||||
FROM CIRCLE_TBL;
|
||||
six | polygon
|
||||
-----+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
| ((-3,0),(-2.12132034355964,2.12132034355964),(-1.83690953073357e-16,3),(2.12132034355964,2.12132034355964),(3,3.67381906146713e-16),(2.12132034355964,-2.12132034355964),(5.5107285922007e-16,-3),(-2.12132034355964,-2.12132034355964))
|
||||
| ((-99,2),(-69.7106781186548,72.7106781186548),(0.999999999999994,102),(71.7106781186547,72.7106781186548),(101,2.00000000000001),(71.7106781186548,-68.7106781186547),(1.00000000000002,-98),(-69.7106781186547,-68.7106781186548))
|
||||
| ((-4,3),(-2.53553390593274,6.53553390593274),(1,8),(4.53553390593274,6.53553390593274),(6,3),(4.53553390593274,-0.535533905932737),(1,-2),(-2.53553390593274,-0.535533905932738))
|
||||
| ((-2,2),(-1.12132034355964,4.12132034355964),(1,5),(3.12132034355964,4.12132034355964),(4,2),(3.12132034355964,-0.121320343559642),(1,-1),(-1.12132034355964,-0.121320343559643))
|
||||
| ((90,200),(92.9289321881345,207.071067811865),(100,210),(107.071067811865,207.071067811865),(110,200),(107.071067811865,192.928932188135),(100,190),(92.9289321881345,192.928932188135))
|
||||
| ((0,0),(29.2893218813452,70.7106781186548),(100,100),(170.710678118655,70.7106781186548),(200,1.22460635382238e-14),(170.710678118655,-70.7106781186547),(100,-100),(29.2893218813453,-70.7106781186548))
|
||||
(6 rows)
|
||||
|
||||
--
|
||||
-- Circles
|
||||
--
|
||||
SELECT '' AS six, circle(f1, 50.0)
|
||||
FROM POINT_TBL;
|
||||
six | circle
|
||||
-----+-----------------
|
||||
| <(0,0),50>
|
||||
| <(-10,0),50>
|
||||
| <(-3,4),50>
|
||||
| <(5.1,34.5),50>
|
||||
| <(-5,-12),50>
|
||||
| <(10,10),50>
|
||||
(6 rows)
|
||||
|
||||
SELECT '' AS four, circle(f1)
|
||||
FROM BOX_TBL;
|
||||
four | circle
|
||||
------+-------------------------
|
||||
| <(1,1),1.4142135623731>
|
||||
| <(2,2),1.4142135623731>
|
||||
| <(2.5,3),0.5>
|
||||
| <(3,3),0>
|
||||
(4 rows)
|
||||
|
||||
SELECT '' AS two, circle(f1)
|
||||
FROM POLYGON_TBL
|
||||
WHERE (# f1) >= 3;
|
||||
two | circle
|
||||
-----+--------------------------------------------------------
|
||||
| <(1.33333333333333,1.33333333333333),2.04168905063636>
|
||||
| <(2.33333333333333,1.33333333333333),1.47534300379185>
|
||||
(2 rows)
|
||||
|
||||
SELECT '' AS twentyfour, c1.f1 AS circle, p1.f1 AS point, (p1.f1 <-> c1.f1) AS distance
|
||||
FROM CIRCLE_TBL c1, POINT_TBL p1
|
||||
WHERE (p1.f1 <-> c1.f1) > 0
|
||||
ORDER BY distance, circle, point using <<;
|
||||
twentyfour | circle | point | distance
|
||||
------------+----------------+------------+-------------------
|
||||
| <(100,0),100> | (5.1,34.5) | 0.976531926977964
|
||||
| <(1,2),3> | (-3,4) | 1.47213595499958
|
||||
| <(0,0),3> | (-3,4) | 2
|
||||
| <(100,0),100> | (-3,4) | 3.07764064044151
|
||||
| <(100,0),100> | (-5,-12) | 5.68348972285122
|
||||
| <(1,3),5> | (-10,0) | 6.40175425099138
|
||||
| <(1,3),5> | (10,10) | 6.40175425099138
|
||||
| <(0,0),3> | (-10,0) | 7
|
||||
| <(1,2),3> | (-10,0) | 8.18033988749895
|
||||
| <(1,2),3> | (10,10) | 9.0415945787923
|
||||
| <(0,0),3> | (-5,-12) | 10
|
||||
| <(100,0),100> | (-10,0) | 10
|
||||
| <(0,0),3> | (10,10) | 11.142135623731
|
||||
| <(1,3),5> | (-5,-12) | 11.1554944214035
|
||||
| <(1,2),3> | (-5,-12) | 12.2315462117278
|
||||
| <(1,3),5> | (5.1,34.5) | 26.7657047773224
|
||||
| <(1,2),3> | (5.1,34.5) | 29.757594539282
|
||||
| <(0,0),3> | (5.1,34.5) | 31.8749193547455
|
||||
| <(100,200),10> | (5.1,34.5) | 180.778038568384
|
||||
| <(100,200),10> | (10,10) | 200.237960416286
|
||||
| <(100,200),10> | (-3,4) | 211.415898254845
|
||||
| <(100,200),10> | (0,0) | 213.606797749979
|
||||
| <(100,200),10> | (-10,0) | 218.254244210267
|
||||
| <(100,200),10> | (-5,-12) | 226.577682802077
|
||||
(24 rows)
|
||||
|
||||
215
src/test/regress/expected/int2-range-error.out
Normal file
215
src/test/regress/expected/int2-range-error.out
Normal file
@@ -0,0 +1,215 @@
|
||||
--
|
||||
-- INT2
|
||||
-- NOTE: int2 operators never check for over/underflow!
|
||||
-- Some of these answers are consequently numerically incorrect.
|
||||
--
|
||||
CREATE TABLE INT2_TBL(f1 int2);
|
||||
INSERT INTO INT2_TBL(f1) VALUES ('0');
|
||||
INSERT INTO INT2_TBL(f1) VALUES ('1234');
|
||||
INSERT INTO INT2_TBL(f1) VALUES ('-1234');
|
||||
INSERT INTO INT2_TBL(f1) VALUES ('34.5');
|
||||
ERROR: pg_atoi: error in "34.5": can't parse ".5"
|
||||
-- largest and smallest values
|
||||
INSERT INTO INT2_TBL(f1) VALUES ('32767');
|
||||
INSERT INTO INT2_TBL(f1) VALUES ('-32767');
|
||||
-- bad input values -- should give warnings
|
||||
INSERT INTO INT2_TBL(f1) VALUES ('100000');
|
||||
ERROR: pg_atoi: error reading "100000": Range Error
|
||||
INSERT INTO INT2_TBL(f1) VALUES ('asdf');
|
||||
ERROR: pg_atoi: error in "asdf": can't parse "asdf"
|
||||
SELECT '' AS five, INT2_TBL.*;
|
||||
five | f1
|
||||
------+--------
|
||||
| 0
|
||||
| 1234
|
||||
| -1234
|
||||
| 32767
|
||||
| -32767
|
||||
(5 rows)
|
||||
|
||||
SELECT '' AS four, i.* FROM INT2_TBL i WHERE i.f1 <> int2 '0';
|
||||
four | f1
|
||||
------+--------
|
||||
| 1234
|
||||
| -1234
|
||||
| 32767
|
||||
| -32767
|
||||
(4 rows)
|
||||
|
||||
SELECT '' AS four, i.* FROM INT2_TBL i WHERE i.f1 <> int4 '0';
|
||||
four | f1
|
||||
------+--------
|
||||
| 1234
|
||||
| -1234
|
||||
| 32767
|
||||
| -32767
|
||||
(4 rows)
|
||||
|
||||
SELECT '' AS one, i.* FROM INT2_TBL i WHERE i.f1 = int2 '0';
|
||||
one | f1
|
||||
-----+----
|
||||
| 0
|
||||
(1 row)
|
||||
|
||||
SELECT '' AS one, i.* FROM INT2_TBL i WHERE i.f1 = int4 '0';
|
||||
one | f1
|
||||
-----+----
|
||||
| 0
|
||||
(1 row)
|
||||
|
||||
SELECT '' AS two, i.* FROM INT2_TBL i WHERE i.f1 < int2 '0';
|
||||
two | f1
|
||||
-----+--------
|
||||
| -1234
|
||||
| -32767
|
||||
(2 rows)
|
||||
|
||||
SELECT '' AS two, i.* FROM INT2_TBL i WHERE i.f1 < int4 '0';
|
||||
two | f1
|
||||
-----+--------
|
||||
| -1234
|
||||
| -32767
|
||||
(2 rows)
|
||||
|
||||
SELECT '' AS three, i.* FROM INT2_TBL i WHERE i.f1 <= int2 '0';
|
||||
three | f1
|
||||
-------+--------
|
||||
| 0
|
||||
| -1234
|
||||
| -32767
|
||||
(3 rows)
|
||||
|
||||
SELECT '' AS three, i.* FROM INT2_TBL i WHERE i.f1 <= int4 '0';
|
||||
three | f1
|
||||
-------+--------
|
||||
| 0
|
||||
| -1234
|
||||
| -32767
|
||||
(3 rows)
|
||||
|
||||
SELECT '' AS two, i.* FROM INT2_TBL i WHERE i.f1 > int2 '0';
|
||||
two | f1
|
||||
-----+-------
|
||||
| 1234
|
||||
| 32767
|
||||
(2 rows)
|
||||
|
||||
SELECT '' AS two, i.* FROM INT2_TBL i WHERE i.f1 > int4 '0';
|
||||
two | f1
|
||||
-----+-------
|
||||
| 1234
|
||||
| 32767
|
||||
(2 rows)
|
||||
|
||||
SELECT '' AS three, i.* FROM INT2_TBL i WHERE i.f1 >= int2 '0';
|
||||
three | f1
|
||||
-------+-------
|
||||
| 0
|
||||
| 1234
|
||||
| 32767
|
||||
(3 rows)
|
||||
|
||||
SELECT '' AS three, i.* FROM INT2_TBL i WHERE i.f1 >= int4 '0';
|
||||
three | f1
|
||||
-------+-------
|
||||
| 0
|
||||
| 1234
|
||||
| 32767
|
||||
(3 rows)
|
||||
|
||||
-- positive odds
|
||||
SELECT '' AS one, i.* FROM INT2_TBL i WHERE (i.f1 % int2 '2') = int2 '1';
|
||||
one | f1
|
||||
-----+-------
|
||||
| 32767
|
||||
(1 row)
|
||||
|
||||
-- any evens
|
||||
SELECT '' AS three, i.* FROM INT2_TBL i WHERE (i.f1 % int4 '2') = int2 '0';
|
||||
three | f1
|
||||
-------+-------
|
||||
| 0
|
||||
| 1234
|
||||
| -1234
|
||||
(3 rows)
|
||||
|
||||
SELECT '' AS five, i.f1, i.f1 * int2 '2' AS x FROM INT2_TBL i;
|
||||
five | f1 | x
|
||||
------+--------+-------
|
||||
| 0 | 0
|
||||
| 1234 | 2468
|
||||
| -1234 | -2468
|
||||
| 32767 | -2
|
||||
| -32767 | 2
|
||||
(5 rows)
|
||||
|
||||
SELECT '' AS five, i.f1, i.f1 * int4 '2' AS x FROM INT2_TBL i;
|
||||
five | f1 | x
|
||||
------+--------+--------
|
||||
| 0 | 0
|
||||
| 1234 | 2468
|
||||
| -1234 | -2468
|
||||
| 32767 | 65534
|
||||
| -32767 | -65534
|
||||
(5 rows)
|
||||
|
||||
SELECT '' AS five, i.f1, i.f1 + int2 '2' AS x FROM INT2_TBL i;
|
||||
five | f1 | x
|
||||
------+--------+--------
|
||||
| 0 | 2
|
||||
| 1234 | 1236
|
||||
| -1234 | -1232
|
||||
| 32767 | -32767
|
||||
| -32767 | -32765
|
||||
(5 rows)
|
||||
|
||||
SELECT '' AS five, i.f1, i.f1 + int4 '2' AS x FROM INT2_TBL i;
|
||||
five | f1 | x
|
||||
------+--------+--------
|
||||
| 0 | 2
|
||||
| 1234 | 1236
|
||||
| -1234 | -1232
|
||||
| 32767 | 32769
|
||||
| -32767 | -32765
|
||||
(5 rows)
|
||||
|
||||
SELECT '' AS five, i.f1, i.f1 - int2 '2' AS x FROM INT2_TBL i;
|
||||
five | f1 | x
|
||||
------+--------+-------
|
||||
| 0 | -2
|
||||
| 1234 | 1232
|
||||
| -1234 | -1236
|
||||
| 32767 | 32765
|
||||
| -32767 | 32767
|
||||
(5 rows)
|
||||
|
||||
SELECT '' AS five, i.f1, i.f1 - int4 '2' AS x FROM INT2_TBL i;
|
||||
five | f1 | x
|
||||
------+--------+--------
|
||||
| 0 | -2
|
||||
| 1234 | 1232
|
||||
| -1234 | -1236
|
||||
| 32767 | 32765
|
||||
| -32767 | -32769
|
||||
(5 rows)
|
||||
|
||||
SELECT '' AS five, i.f1, i.f1 / int2 '2' AS x FROM INT2_TBL i;
|
||||
five | f1 | x
|
||||
------+--------+--------
|
||||
| 0 | 0
|
||||
| 1234 | 617
|
||||
| -1234 | -617
|
||||
| 32767 | 16383
|
||||
| -32767 | -16383
|
||||
(5 rows)
|
||||
|
||||
SELECT '' AS five, i.f1, i.f1 / int4 '2' AS x FROM INT2_TBL i;
|
||||
five | f1 | x
|
||||
------+--------+--------
|
||||
| 0 | 0
|
||||
| 1234 | 617
|
||||
| -1234 | -617
|
||||
| 32767 | 16383
|
||||
| -32767 | -16383
|
||||
(5 rows)
|
||||
|
||||
297
src/test/regress/expected/int4-range-error.out
Normal file
297
src/test/regress/expected/int4-range-error.out
Normal file
@@ -0,0 +1,297 @@
|
||||
--
|
||||
-- INT4
|
||||
-- WARNING: int4 operators never check for over/underflow!
|
||||
-- Some of these answers are consequently numerically incorrect.
|
||||
--
|
||||
CREATE TABLE INT4_TBL(f1 int4);
|
||||
INSERT INTO INT4_TBL(f1) VALUES ('0');
|
||||
INSERT INTO INT4_TBL(f1) VALUES ('123456');
|
||||
INSERT INTO INT4_TBL(f1) VALUES ('-123456');
|
||||
INSERT INTO INT4_TBL(f1) VALUES ('34.5');
|
||||
ERROR: pg_atoi: error in "34.5": can't parse ".5"
|
||||
-- largest and smallest values
|
||||
INSERT INTO INT4_TBL(f1) VALUES ('2147483647');
|
||||
INSERT INTO INT4_TBL(f1) VALUES ('-2147483647');
|
||||
-- bad input values -- should give warnings
|
||||
INSERT INTO INT4_TBL(f1) VALUES ('1000000000000');
|
||||
ERROR: pg_atoi: error reading "1000000000000": Range Error
|
||||
INSERT INTO INT4_TBL(f1) VALUES ('asdf');
|
||||
ERROR: pg_atoi: error in "asdf": can't parse "asdf"
|
||||
SELECT '' AS five, INT4_TBL.*;
|
||||
five | f1
|
||||
------+-------------
|
||||
| 0
|
||||
| 123456
|
||||
| -123456
|
||||
| 2147483647
|
||||
| -2147483647
|
||||
(5 rows)
|
||||
|
||||
SELECT '' AS four, i.* FROM INT4_TBL i WHERE i.f1 <> int2 '0';
|
||||
four | f1
|
||||
------+-------------
|
||||
| 123456
|
||||
| -123456
|
||||
| 2147483647
|
||||
| -2147483647
|
||||
(4 rows)
|
||||
|
||||
SELECT '' AS four, i.* FROM INT4_TBL i WHERE i.f1 <> int4 '0';
|
||||
four | f1
|
||||
------+-------------
|
||||
| 123456
|
||||
| -123456
|
||||
| 2147483647
|
||||
| -2147483647
|
||||
(4 rows)
|
||||
|
||||
SELECT '' AS one, i.* FROM INT4_TBL i WHERE i.f1 = int2 '0';
|
||||
one | f1
|
||||
-----+----
|
||||
| 0
|
||||
(1 row)
|
||||
|
||||
SELECT '' AS one, i.* FROM INT4_TBL i WHERE i.f1 = int4 '0';
|
||||
one | f1
|
||||
-----+----
|
||||
| 0
|
||||
(1 row)
|
||||
|
||||
SELECT '' AS two, i.* FROM INT4_TBL i WHERE i.f1 < int2 '0';
|
||||
two | f1
|
||||
-----+-------------
|
||||
| -123456
|
||||
| -2147483647
|
||||
(2 rows)
|
||||
|
||||
SELECT '' AS two, i.* FROM INT4_TBL i WHERE i.f1 < int4 '0';
|
||||
two | f1
|
||||
-----+-------------
|
||||
| -123456
|
||||
| -2147483647
|
||||
(2 rows)
|
||||
|
||||
SELECT '' AS three, i.* FROM INT4_TBL i WHERE i.f1 <= int2 '0';
|
||||
three | f1
|
||||
-------+-------------
|
||||
| 0
|
||||
| -123456
|
||||
| -2147483647
|
||||
(3 rows)
|
||||
|
||||
SELECT '' AS three, i.* FROM INT4_TBL i WHERE i.f1 <= int4 '0';
|
||||
three | f1
|
||||
-------+-------------
|
||||
| 0
|
||||
| -123456
|
||||
| -2147483647
|
||||
(3 rows)
|
||||
|
||||
SELECT '' AS two, i.* FROM INT4_TBL i WHERE i.f1 > int2 '0';
|
||||
two | f1
|
||||
-----+------------
|
||||
| 123456
|
||||
| 2147483647
|
||||
(2 rows)
|
||||
|
||||
SELECT '' AS two, i.* FROM INT4_TBL i WHERE i.f1 > int4 '0';
|
||||
two | f1
|
||||
-----+------------
|
||||
| 123456
|
||||
| 2147483647
|
||||
(2 rows)
|
||||
|
||||
SELECT '' AS three, i.* FROM INT4_TBL i WHERE i.f1 >= int2 '0';
|
||||
three | f1
|
||||
-------+------------
|
||||
| 0
|
||||
| 123456
|
||||
| 2147483647
|
||||
(3 rows)
|
||||
|
||||
SELECT '' AS three, i.* FROM INT4_TBL i WHERE i.f1 >= int4 '0';
|
||||
three | f1
|
||||
-------+------------
|
||||
| 0
|
||||
| 123456
|
||||
| 2147483647
|
||||
(3 rows)
|
||||
|
||||
-- positive odds
|
||||
SELECT '' AS one, i.* FROM INT4_TBL i WHERE (i.f1 % int2 '2') = int2 '1';
|
||||
one | f1
|
||||
-----+------------
|
||||
| 2147483647
|
||||
(1 row)
|
||||
|
||||
-- any evens
|
||||
SELECT '' AS three, i.* FROM INT4_TBL i WHERE (i.f1 % int4 '2') = int2 '0';
|
||||
three | f1
|
||||
-------+---------
|
||||
| 0
|
||||
| 123456
|
||||
| -123456
|
||||
(3 rows)
|
||||
|
||||
SELECT '' AS five, i.f1, i.f1 * int2 '2' AS x FROM INT4_TBL i;
|
||||
five | f1 | x
|
||||
------+-------------+---------
|
||||
| 0 | 0
|
||||
| 123456 | 246912
|
||||
| -123456 | -246912
|
||||
| 2147483647 | -2
|
||||
| -2147483647 | 2
|
||||
(5 rows)
|
||||
|
||||
SELECT '' AS five, i.f1, i.f1 * int4 '2' AS x FROM INT4_TBL i;
|
||||
five | f1 | x
|
||||
------+-------------+---------
|
||||
| 0 | 0
|
||||
| 123456 | 246912
|
||||
| -123456 | -246912
|
||||
| 2147483647 | -2
|
||||
| -2147483647 | 2
|
||||
(5 rows)
|
||||
|
||||
SELECT '' AS five, i.f1, i.f1 + int2 '2' AS x FROM INT4_TBL i;
|
||||
five | f1 | x
|
||||
------+-------------+-------------
|
||||
| 0 | 2
|
||||
| 123456 | 123458
|
||||
| -123456 | -123454
|
||||
| 2147483647 | -2147483647
|
||||
| -2147483647 | -2147483645
|
||||
(5 rows)
|
||||
|
||||
SELECT '' AS five, i.f1, i.f1 + int4 '2' AS x FROM INT4_TBL i;
|
||||
five | f1 | x
|
||||
------+-------------+-------------
|
||||
| 0 | 2
|
||||
| 123456 | 123458
|
||||
| -123456 | -123454
|
||||
| 2147483647 | -2147483647
|
||||
| -2147483647 | -2147483645
|
||||
(5 rows)
|
||||
|
||||
SELECT '' AS five, i.f1, i.f1 - int2 '2' AS x FROM INT4_TBL i;
|
||||
five | f1 | x
|
||||
------+-------------+------------
|
||||
| 0 | -2
|
||||
| 123456 | 123454
|
||||
| -123456 | -123458
|
||||
| 2147483647 | 2147483645
|
||||
| -2147483647 | 2147483647
|
||||
(5 rows)
|
||||
|
||||
SELECT '' AS five, i.f1, i.f1 - int4 '2' AS x FROM INT4_TBL i;
|
||||
five | f1 | x
|
||||
------+-------------+------------
|
||||
| 0 | -2
|
||||
| 123456 | 123454
|
||||
| -123456 | -123458
|
||||
| 2147483647 | 2147483645
|
||||
| -2147483647 | 2147483647
|
||||
(5 rows)
|
||||
|
||||
SELECT '' AS five, i.f1, i.f1 / int2 '2' AS x FROM INT4_TBL i;
|
||||
five | f1 | x
|
||||
------+-------------+-------------
|
||||
| 0 | 0
|
||||
| 123456 | 61728
|
||||
| -123456 | -61728
|
||||
| 2147483647 | 1073741823
|
||||
| -2147483647 | -1073741823
|
||||
(5 rows)
|
||||
|
||||
SELECT '' AS five, i.f1, i.f1 / int4 '2' AS x FROM INT4_TBL i;
|
||||
five | f1 | x
|
||||
------+-------------+-------------
|
||||
| 0 | 0
|
||||
| 123456 | 61728
|
||||
| -123456 | -61728
|
||||
| 2147483647 | 1073741823
|
||||
| -2147483647 | -1073741823
|
||||
(5 rows)
|
||||
|
||||
--
|
||||
-- more complex expressions
|
||||
--
|
||||
-- variations on unary minus parsing
|
||||
SELECT -2+3 AS one;
|
||||
one
|
||||
-----
|
||||
1
|
||||
(1 row)
|
||||
|
||||
SELECT 4-2 AS two;
|
||||
two
|
||||
-----
|
||||
2
|
||||
(1 row)
|
||||
|
||||
SELECT 2- -1 AS three;
|
||||
three
|
||||
-------
|
||||
3
|
||||
(1 row)
|
||||
|
||||
SELECT 2 - -2 AS four;
|
||||
four
|
||||
------
|
||||
4
|
||||
(1 row)
|
||||
|
||||
SELECT int2 '2' * int2 '2' = int2 '16' / int2 '4' AS true;
|
||||
true
|
||||
------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT int4 '2' * int2 '2' = int2 '16' / int4 '4' AS true;
|
||||
true
|
||||
------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT int2 '2' * int4 '2' = int4 '16' / int2 '4' AS true;
|
||||
true
|
||||
------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT int4 '1000' < int4 '999' AS false;
|
||||
false
|
||||
-------
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT 4! AS twenty_four;
|
||||
twenty_four
|
||||
-------------
|
||||
24
|
||||
(1 row)
|
||||
|
||||
SELECT !!3 AS six;
|
||||
six
|
||||
-----
|
||||
6
|
||||
(1 row)
|
||||
|
||||
SELECT 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 AS ten;
|
||||
ten
|
||||
-----
|
||||
10
|
||||
(1 row)
|
||||
|
||||
SELECT 2 + 2 / 2 AS three;
|
||||
three
|
||||
-------
|
||||
3
|
||||
(1 row)
|
||||
|
||||
SELECT (2 + 2) / 2 AS two;
|
||||
two
|
||||
-----
|
||||
2
|
||||
(1 row)
|
||||
|
||||
@@ -1084,179 +1084,8 @@ SELECT * FROM shoelace ORDER BY sl_name;
|
||||
(8 rows)
|
||||
|
||||
insert into shoelace_ok select * from shoelace_arrive;
|
||||
SELECT * FROM shoelace ORDER BY sl_name;
|
||||
sl_name | sl_avail | sl_color | sl_len | sl_unit | sl_len_cm
|
||||
------------+----------+------------+--------+----------+-----------
|
||||
sl1 | 5 | black | 80 | cm | 80
|
||||
sl2 | 6 | black | 100 | cm | 100
|
||||
sl3 | 10 | black | 35 | inch | 88.9
|
||||
sl4 | 8 | black | 40 | inch | 101.6
|
||||
sl5 | 4 | brown | 1 | m | 100
|
||||
sl6 | 20 | brown | 0.9 | m | 90
|
||||
sl7 | 6 | brown | 60 | cm | 60
|
||||
sl8 | 21 | brown | 40 | inch | 101.6
|
||||
(8 rows)
|
||||
|
||||
SELECT * FROM shoelace_log ORDER BY sl_name;
|
||||
sl_name | sl_avail | log_who | log_when
|
||||
------------+----------+----------+----------
|
||||
sl3 | 10 | Al Bundy | epoch
|
||||
sl6 | 20 | Al Bundy | epoch
|
||||
sl7 | 6 | Al Bundy | epoch
|
||||
sl8 | 21 | Al Bundy | epoch
|
||||
(4 rows)
|
||||
|
||||
CREATE VIEW shoelace_obsolete AS
|
||||
SELECT * FROM shoelace WHERE NOT EXISTS
|
||||
(SELECT shoename FROM shoe WHERE slcolor = sl_color);
|
||||
CREATE VIEW shoelace_candelete AS
|
||||
SELECT * FROM shoelace_obsolete WHERE sl_avail = 0;
|
||||
insert into shoelace values ('sl9', 0, 'pink', 35.0, 'inch', 0.0);
|
||||
insert into shoelace values ('sl10', 1000, 'magenta', 40.0, 'inch', 0.0);
|
||||
SELECT * FROM shoelace_obsolete;
|
||||
sl_name | sl_avail | sl_color | sl_len | sl_unit | sl_len_cm
|
||||
------------+----------+------------+--------+----------+-----------
|
||||
sl9 | 0 | pink | 35 | inch | 88.9
|
||||
sl10 | 1000 | magenta | 40 | inch | 101.6
|
||||
(2 rows)
|
||||
|
||||
SELECT * FROM shoelace_candelete;
|
||||
sl_name | sl_avail | sl_color | sl_len | sl_unit | sl_len_cm
|
||||
------------+----------+------------+--------+----------+-----------
|
||||
sl9 | 0 | pink | 35 | inch | 88.9
|
||||
(1 row)
|
||||
|
||||
DELETE FROM shoelace WHERE EXISTS
|
||||
(SELECT * FROM shoelace_candelete
|
||||
WHERE sl_name = shoelace.sl_name);
|
||||
SELECT * FROM shoelace ORDER BY sl_name;
|
||||
sl_name | sl_avail | sl_color | sl_len | sl_unit | sl_len_cm
|
||||
------------+----------+------------+--------+----------+-----------
|
||||
sl1 | 5 | black | 80 | cm | 80
|
||||
sl10 | 1000 | magenta | 40 | inch | 101.6
|
||||
sl2 | 6 | black | 100 | cm | 100
|
||||
sl3 | 10 | black | 35 | inch | 88.9
|
||||
sl4 | 8 | black | 40 | inch | 101.6
|
||||
sl5 | 4 | brown | 1 | m | 100
|
||||
sl6 | 20 | brown | 0.9 | m | 90
|
||||
sl7 | 6 | brown | 60 | cm | 60
|
||||
sl8 | 21 | brown | 40 | inch | 101.6
|
||||
(9 rows)
|
||||
|
||||
SELECT * FROM shoe ORDER BY shoename;
|
||||
shoename | sh_avail | slcolor | slminlen | slminlen_cm | slmaxlen | slmaxlen_cm | slunit
|
||||
------------+----------+------------+----------+-------------+----------+-------------+----------
|
||||
sh1 | 2 | black | 70 | 70 | 90 | 90 | cm
|
||||
sh2 | 0 | black | 30 | 76.2 | 40 | 101.6 | inch
|
||||
sh3 | 4 | brown | 50 | 50 | 65 | 65 | cm
|
||||
sh4 | 3 | brown | 40 | 101.6 | 50 | 127 | inch
|
||||
(4 rows)
|
||||
|
||||
SELECT count(*) FROM shoe;
|
||||
count
|
||||
-------
|
||||
4
|
||||
(1 row)
|
||||
|
||||
--
|
||||
-- Simple test of qualified ON INSERT ... this did not work in 7.0 ...
|
||||
--
|
||||
create table foo (f1 int);
|
||||
create table foo2 (f1 int);
|
||||
create rule foorule as on insert to foo where f1 < 100
|
||||
do instead nothing;
|
||||
insert into foo values(1);
|
||||
insert into foo values(1001);
|
||||
select * from foo;
|
||||
f1
|
||||
------
|
||||
1001
|
||||
(1 row)
|
||||
|
||||
drop rule foorule;
|
||||
-- this should fail because f1 is not exposed for unqualified reference:
|
||||
create rule foorule as on insert to foo where f1 < 100
|
||||
do instead insert into foo2 values (f1);
|
||||
ERROR: Attribute 'f1' not found
|
||||
-- this is the correct way:
|
||||
create rule foorule as on insert to foo where f1 < 100
|
||||
do instead insert into foo2 values (new.f1);
|
||||
insert into foo values(2);
|
||||
insert into foo values(100);
|
||||
select * from foo;
|
||||
f1
|
||||
------
|
||||
1001
|
||||
100
|
||||
(2 rows)
|
||||
|
||||
select * from foo2;
|
||||
f1
|
||||
----
|
||||
2
|
||||
(1 row)
|
||||
|
||||
drop rule foorule;
|
||||
drop table foo;
|
||||
drop table foo2;
|
||||
--
|
||||
-- Check that ruleutils are working
|
||||
--
|
||||
SELECT viewname, definition FROM pg_views ORDER BY viewname;
|
||||
viewname | definition
|
||||
--------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
iexit | SELECT ih.name, ih.thepath, interpt_pp(ih.thepath, r.thepath) AS exit FROM ihighway ih, ramp r WHERE (ih.thepath ## r.thepath);
|
||||
pg_indexes | SELECT c.relname AS tablename, i.relname AS indexname, pg_get_indexdef(x.indexrelid) AS indexdef FROM pg_index x, pg_class c, pg_class i WHERE ((c.oid = x.indrelid) AND (i.oid = x.indexrelid));
|
||||
pg_rules | SELECT c.relname AS tablename, r.rulename, pg_get_ruledef(r.rulename) AS definition FROM pg_rewrite r, pg_class c WHERE ((r.rulename !~ '^_RET'::text) AND (c.oid = r.ev_class));
|
||||
pg_tables | SELECT c.relname AS tablename, pg_get_userbyid(c.relowner) AS tableowner, c.relhasindex AS hasindexes, c.relhasrules AS hasrules, (c.reltriggers > 0) AS hastriggers FROM pg_class c WHERE (((c.relkind = 'r'::"char") OR (c.relkind = 's'::"char")) AND (NOT (EXISTS (SELECT pg_rewrite.rulename FROM pg_rewrite WHERE ((pg_rewrite.ev_class = c.oid) AND (pg_rewrite.ev_type = '1'::"char"))))));
|
||||
pg_user | SELECT pg_shadow.usename, pg_shadow.usesysid, pg_shadow.usecreatedb, pg_shadow.usetrace, pg_shadow.usesuper, pg_shadow.usecatupd, '********'::text AS passwd, pg_shadow.valuntil FROM pg_shadow;
|
||||
pg_views | SELECT c.relname AS viewname, pg_get_userbyid(c.relowner) AS viewowner, pg_get_viewdef(c.relname) AS definition FROM pg_class c WHERE (c.relhasrules AND (EXISTS (SELECT r.rulename FROM pg_rewrite r WHERE ((r.ev_class = c.oid) AND (r.ev_type = '1'::"char")))));
|
||||
rtest_v1 | SELECT rtest_t1.a, rtest_t1.b FROM rtest_t1;
|
||||
rtest_vcomp | SELECT x.part, (x.size * y.factor) AS size_in_cm FROM rtest_comp x, rtest_unitfact y WHERE (x.unit = y.unit);
|
||||
rtest_vview1 | SELECT x.a, x.b FROM rtest_view1 x WHERE (0 < (SELECT count(*) AS count FROM rtest_view2 y WHERE (y.a = x.a)));
|
||||
rtest_vview2 | SELECT rtest_view1.a, rtest_view1.b FROM rtest_view1 WHERE rtest_view1.v;
|
||||
rtest_vview3 | SELECT x.a, x.b FROM rtest_vview2 x WHERE (0 < (SELECT count(*) AS count FROM rtest_view2 y WHERE (y.a = x.a)));
|
||||
rtest_vview4 | SELECT x.a, x.b, count(y.a) AS refcount FROM rtest_view1 x, rtest_view2 y WHERE (x.a = y.a) GROUP BY x.a, x.b;
|
||||
rtest_vview5 | SELECT rtest_view1.a, rtest_view1.b, rtest_viewfunc1(rtest_view1.a) AS refcount FROM rtest_view1;
|
||||
shoe | SELECT sh.shoename, sh.sh_avail, sh.slcolor, sh.slminlen, (sh.slminlen * un.un_fact) AS slminlen_cm, sh.slmaxlen, (sh.slmaxlen * un.un_fact) AS slmaxlen_cm, sh.slunit FROM shoe_data sh, unit un WHERE (sh.slunit = un.un_name);
|
||||
shoe_ready | SELECT rsh.shoename, rsh.sh_avail, rsl.sl_name, rsl.sl_avail, int4smaller(rsh.sh_avail, rsl.sl_avail) AS total_avail FROM shoe rsh, shoelace rsl WHERE (((rsl.sl_color = rsh.slcolor) AND (rsl.sl_len_cm >= rsh.slminlen_cm)) AND (rsl.sl_len_cm <= rsh.slmaxlen_cm));
|
||||
shoelace | SELECT s.sl_name, s.sl_avail, s.sl_color, s.sl_len, s.sl_unit, (s.sl_len * u.un_fact) AS sl_len_cm FROM shoelace_data s, unit u WHERE (s.sl_unit = u.un_name);
|
||||
shoelace_candelete | SELECT shoelace_obsolete.sl_name, shoelace_obsolete.sl_avail, shoelace_obsolete.sl_color, shoelace_obsolete.sl_len, shoelace_obsolete.sl_unit, shoelace_obsolete.sl_len_cm FROM shoelace_obsolete WHERE (shoelace_obsolete.sl_avail = 0);
|
||||
shoelace_obsolete | SELECT shoelace.sl_name, shoelace.sl_avail, shoelace.sl_color, shoelace.sl_len, shoelace.sl_unit, shoelace.sl_len_cm FROM shoelace WHERE (NOT (EXISTS (SELECT shoe.shoename FROM shoe WHERE (shoe.slcolor = shoelace.sl_color))));
|
||||
street | SELECT r.name, r.thepath, c.cname FROM ONLY road r, real_city c WHERE (c.outline ## r.thepath);
|
||||
toyemp | SELECT emp.name, emp.age, emp."location", (12 * emp.salary) AS annualsal FROM emp;
|
||||
(20 rows)
|
||||
|
||||
SELECT tablename, rulename, definition FROM pg_rules
|
||||
ORDER BY tablename, rulename;
|
||||
tablename | rulename | definition
|
||||
---------------+-----------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
rtest_emp | rtest_emp_del | CREATE RULE rtest_emp_del AS ON DELETE TO rtest_emp DO INSERT INTO rtest_emplog (ename, who, "action", newsal, oldsal) VALUES (old.ename, "current_user"(), 'fired '::bpchar, '$0.00'::money, old.salary);
|
||||
rtest_emp | rtest_emp_ins | CREATE RULE rtest_emp_ins AS ON INSERT TO rtest_emp DO INSERT INTO rtest_emplog (ename, who, "action", newsal, oldsal) VALUES (new.ename, "current_user"(), 'hired '::bpchar, new.salary, '$0.00'::money);
|
||||
rtest_emp | rtest_emp_upd | CREATE RULE rtest_emp_upd AS ON UPDATE TO rtest_emp WHERE (new.salary <> old.salary) DO INSERT INTO rtest_emplog (ename, who, "action", newsal, oldsal) VALUES (new.ename, "current_user"(), 'honored '::bpchar, new.salary, old.salary);
|
||||
rtest_nothn1 | rtest_nothn_r1 | CREATE RULE rtest_nothn_r1 AS ON INSERT TO rtest_nothn1 WHERE ((new.a >= 10) AND (new.a < 20)) DO INSTEAD SELECT 1;
|
||||
rtest_nothn1 | rtest_nothn_r2 | CREATE RULE rtest_nothn_r2 AS ON INSERT TO rtest_nothn1 WHERE ((new.a >= 30) AND (new.a < 40)) DO INSTEAD NOTHING;
|
||||
rtest_nothn2 | rtest_nothn_r3 | CREATE RULE rtest_nothn_r3 AS ON INSERT TO rtest_nothn2 WHERE (new.a >= 100) DO INSTEAD INSERT INTO rtest_nothn3 (a, b) VALUES (new.a, new.b);
|
||||
rtest_nothn2 | rtest_nothn_r4 | CREATE RULE rtest_nothn_r4 AS ON INSERT TO rtest_nothn2 DO INSTEAD NOTHING;
|
||||
rtest_order1 | rtest_order_r1 | CREATE RULE rtest_order_r1 AS ON INSERT TO rtest_order1 DO INSTEAD INSERT INTO rtest_order2 (a, b, c) VALUES (new.a, nextval('rtest_seq'::text), 'rule 1 - this should run 3rd or 4th'::text);
|
||||
rtest_order1 | rtest_order_r2 | CREATE RULE rtest_order_r2 AS ON INSERT TO rtest_order1 DO INSERT INTO rtest_order2 (a, b, c) VALUES (new.a, nextval('rtest_seq'::text), 'rule 2 - this should run 1st'::text);
|
||||
rtest_order1 | rtest_order_r3 | CREATE RULE rtest_order_r3 AS ON INSERT TO rtest_order1 DO INSTEAD INSERT INTO rtest_order2 (a, b, c) VALUES (new.a, nextval('rtest_seq'::text), 'rule 3 - this should run 3rd or 4th'::text);
|
||||
rtest_order1 | rtest_order_r4 | CREATE RULE rtest_order_r4 AS ON INSERT TO rtest_order1 WHERE (new.a < 100) DO INSTEAD INSERT INTO rtest_order2 (a, b, c) VALUES (new.a, nextval('rtest_seq'::text), 'rule 4 - this should run 2nd'::text);
|
||||
rtest_person | rtest_pers_del | CREATE RULE rtest_pers_del AS ON DELETE TO rtest_person DO DELETE FROM rtest_admin WHERE (rtest_admin.pname = old.pname);
|
||||
rtest_person | rtest_pers_upd | CREATE RULE rtest_pers_upd AS ON UPDATE TO rtest_person DO UPDATE rtest_admin SET pname = new.pname WHERE (rtest_admin.pname = old.pname);
|
||||
rtest_system | rtest_sys_del | CREATE RULE rtest_sys_del AS ON DELETE TO rtest_system DO (DELETE FROM rtest_interface WHERE (rtest_interface.sysname = old.sysname); DELETE FROM rtest_admin WHERE (rtest_admin.sysname = old.sysname); );
|
||||
rtest_system | rtest_sys_upd | CREATE RULE rtest_sys_upd AS ON UPDATE TO rtest_system DO (UPDATE rtest_interface SET sysname = new.sysname WHERE (rtest_interface.sysname = old.sysname); UPDATE rtest_admin SET sysname = new.sysname WHERE (rtest_admin.sysname = old.sysname); );
|
||||
rtest_t4 | rtest_t4_ins1 | CREATE RULE rtest_t4_ins1 AS ON INSERT TO rtest_t4 WHERE ((new.a >= 10) AND (new.a < 20)) DO INSTEAD INSERT INTO rtest_t5 (a, b) VALUES (new.a, new.b);
|
||||
rtest_t4 | rtest_t4_ins2 | CREATE RULE rtest_t4_ins2 AS ON INSERT TO rtest_t4 WHERE ((new.a >= 20) AND (new.a < 30)) DO INSERT INTO rtest_t6 (a, b) VALUES (new.a, new.b);
|
||||
rtest_t5 | rtest_t5_ins | CREATE RULE rtest_t5_ins AS ON INSERT TO rtest_t5 WHERE (new.a > 15) DO INSERT INTO rtest_t7 (a, b) VALUES (new.a, new.b);
|
||||
rtest_t6 | rtest_t6_ins | CREATE RULE rtest_t6_ins AS ON INSERT TO rtest_t6 WHERE (new.a > 25) DO INSTEAD INSERT INTO rtest_t8 (a, b) VALUES (new.a, new.b);
|
||||
rtest_v1 | rtest_v1_del | CREATE RULE rtest_v1_del AS ON DELETE TO rtest_v1 DO INSTEAD DELETE FROM rtest_t1 WHERE (rtest_t1.a = old.a);
|
||||
rtest_v1 | rtest_v1_ins | CREATE RULE rtest_v1_ins AS ON INSERT TO rtest_v1 DO INSTEAD INSERT INTO rtest_t1 (a, b) VALUES (new.a, new.b);
|
||||
rtest_v1 | rtest_v1_upd | CREATE RULE rtest_v1_upd AS ON UPDATE TO rtest_v1 DO INSTEAD UPDATE rtest_t1 SET a = new.a, b = new.b WHERE (rtest_t1.a = old.a);
|
||||
shoelace | shoelace_del | CREATE RULE shoelace_del AS ON DELETE TO shoelace DO INSTEAD DELETE FROM shoelace_data WHERE (shoelace_data.sl_name = old.sl_name);
|
||||
shoelace | shoelace_ins | CREATE RULE shoelace_ins AS ON INSERT TO shoelace DO INSTEAD INSERT INTO shoelace_data (sl_name, sl_avail, sl_color, sl_len, sl_unit) VALUES (new.sl_name, new.sl_avail, new.sl_color, new.sl_len, new.sl_unit);
|
||||
shoelace | shoelace_upd | CREATE RULE shoelace_upd AS ON UPDATE TO shoelace DO INSTEAD UPDATE shoelace_data SET sl_name = new.sl_name, sl_avail = new.sl_avail, sl_color = new.sl_color, sl_len = new.sl_len, sl_unit = new.sl_unit WHERE (shoelace_data.sl_name = old.sl_name);
|
||||
shoelace_data | log_shoelace | CREATE RULE log_shoelace AS ON UPDATE TO shoelace_data WHERE (new.sl_avail <> old.sl_avail) DO INSERT INTO shoelace_log (sl_name, sl_avail, log_who, log_when) VALUES (new.sl_name, new.sl_avail, 'Al Bundy'::name, "timestamp"('epoch'::text));
|
||||
shoelace_ok | shoelace_ok_ins | CREATE RULE shoelace_ok_ins AS ON INSERT TO shoelace_ok DO INSTEAD UPDATE shoelace SET sl_avail = (shoelace.sl_avail + new.ok_quant) WHERE (shoelace.sl_name = new.ok_name);
|
||||
(27 rows)
|
||||
|
||||
FATAL 1: The system is shutting down
|
||||
pqReadData() -- backend closed the channel unexpectedly.
|
||||
This probably means the backend terminated abnormally
|
||||
before or while processing the request.
|
||||
connection to server was lost
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/bin/sh
|
||||
# $Header: /cvsroot/pgsql/src/test/regress/Attic/regress.sh,v 1.53 2000/09/29 17:17:37 petere Exp $
|
||||
# $Header: /cvsroot/pgsql/src/test/regress/Attic/regress.sh,v 1.54 2000/10/07 14:39:20 momjian Exp $
|
||||
#
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "Syntax: $0 <hostname> [extra-tests]"
|
||||
@@ -11,7 +11,7 @@ shift
|
||||
extratests="$*"
|
||||
|
||||
case $hostname in
|
||||
i*86-pc-cygwin* | i386-*-qnx*)
|
||||
i*86-pc-cygwin* | i386-*-qnx* | beos)
|
||||
HOSTLOC="-h localhost"
|
||||
;;
|
||||
*)
|
||||
|
||||
Reference in New Issue
Block a user