[BACK]Return to restrict_selops.out CVS log [TXT][DIR] Up to [pgFoundry] / uint / uint / expected

File: [pgFoundry] / uint / uint / expected / restrict_selops.out (download)

Revision 1.1, Mon Sep 29 04:53:59 2008 UTC (23 months ago) by rbrad
Branch: MAIN
CVS Tags: HEAD

Initial checking for the unsigned integer data type.

-- uint1 op int4 tests
SELECT * FROM t1_uint1 WHERE f1 > 250;
 f1  
-----
 251
 252
 253
 254
 255
(5 rows)

SELECT * FROM t1_uint1 WHERE f1 < 5;
 f1 
----
 1
 2
 3
 4
(4 rows)

-- int4 op uint1 tests
SELECT * FROM t1_uint1 WHERE 250 < f1;
 f1  
-----
 251
 252
 253
 254
 255
(5 rows)

SELECT * FROM t1_uint1 WHERE 5 > f1;
 f1 
----
 1
 2
 3
 4
(4 rows)

-- uint2 op int4 tests
SELECT * FROM t1_uint2 WHERE f1 > 250;
 f1  
-----
 251
 252
 253
 254
 255
(5 rows)

SELECT * FROM t1_uint2 WHERE f1 < 5;
 f1 
----
 1
 2
 3
 4
(4 rows)

-- int4 op uint2 tests
SELECT * FROM t1_uint2 WHERE 250 < f1;
 f1  
-----
 251
 252
 253
 254
 255
(5 rows)

SELECT * FROM t1_uint2 WHERE 5 > f1;
 f1 
----
 1
 2
 3
 4
(4 rows)

-- uint4 op int4 tests
SELECT * FROM t1_uint4 WHERE f1 > 250;
 f1  
-----
 251
 252
 253
 254
 255
(5 rows)

SELECT * FROM t1_uint4 WHERE f1 < 5;
 f1 
----
 1
 2
 3
 4
(4 rows)

-- int4 op uint4 tests
SELECT * FROM t1_uint4 WHERE 250 < f1;
 f1  
-----
 251
 252
 253
 254
 255
(5 rows)

SELECT * FROM t1_uint4 WHERE 5 > f1;
 f1 
----
 1
 2
 3
 4
(4 rows)

-- Test get_restriction_variable
CREATE TABLE t2_uint4 (col1 uint4 PRIMARY KEY, col2 uint4 NOT NULL);
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "t2_uint4_pkey" for table "t2_uint4"
INSERT INTO t2_uint4 SELECT generate_series(1, 10), generate_series(10, 1, -1);
SELECT * FROM t2_uint4 WHERE col1 > col2;
 col1 | col2 
------+------
 6    | 5
 7    | 4
 8    | 3
 9    | 2
 10   | 1
(5 rows)

SELECT * FROM t2_uint4 WHERE col1 < col2;
 col1 | col2 
------+------
 1    | 10
 2    | 9
 3    | 8
 4    | 7
 5    | 6
(5 rows)

-- Test volatile function
CREATE FUNCTION blah() RETURNS integer AS $$ UPDATE t2_uint4 SET col1 = 5 WHERE col1 = 5; SELECT 5; $$ LANGUAGE SQL VOLATILE;
SELECT * FROM t2_uint4 WHERE col1 <= blah();
 col1 | col2 
------+------
 1    | 10
 2    | 9
 3    | 8
 4    | 7
 5    | 6
(5 rows)

SELECT * FROM t2_uint4 WHERE col1 >= blah();
 col1 | col2 
------+------
 6    | 5
 7    | 4
 8    | 3
 9    | 2
 10   | 1
 5    | 6
(6 rows)

-- Test stable function
DROP FUNCTION blah();
CREATE FUNCTION blah() RETURNS integer AS $$ SELECT col1::int4 FROM t2_uint4 WHERE col1 = 5; $$ LANGUAGE SQL STABLE;
SELECT * FROM t2_uint4 WHERE col1 < blah();
 col1 | col2 
------+------
 1    | 10
 2    | 9
 3    | 8
 4    | 7
(4 rows)

SELECT * FROM t2_uint4 WHERE col1 > blah();
 col1 | col2 
------+------
 6    | 5
 7    | 4
 8    | 3
 9    | 2
 10   | 1
(5 rows)

-- Test immutable function
DROP FUNCTION blah();
CREATE FUNCTION blah() RETURNS integer AS $$ SELECT 5; $$ LANGUAGE SQL IMMUTABLE;
SELECT * FROM t2_uint4 WHERE col1 <= blah();
 col1 | col2 
------+------
 1    | 10
 2    | 9
 3    | 8
 4    | 7
 5    | 6
(5 rows)

SELECT * FROM t2_uint4 WHERE col1 > blah();
 col1 | col2 
------+------
 6    | 5
 7    | 4
 8    | 3
 9    | 2
 10   | 1
(5 rows)