postgresql/src/test/regress/expected/pg_lsn.out

201 lines
3.3 KiB
Plaintext

--
-- PG_LSN
--
CREATE TABLE PG_LSN_TBL (f1 pg_lsn);
-- Largest and smallest input
INSERT INTO PG_LSN_TBL VALUES ('0/0');
INSERT INTO PG_LSN_TBL VALUES ('FFFFFFFF/FFFFFFFF');
-- Incorrect input
INSERT INTO PG_LSN_TBL VALUES ('G/0');
ERROR: invalid input syntax for type pg_lsn: "G/0"
LINE 1: INSERT INTO PG_LSN_TBL VALUES ('G/0');
^
INSERT INTO PG_LSN_TBL VALUES ('-1/0');
ERROR: invalid input syntax for type pg_lsn: "-1/0"
LINE 1: INSERT INTO PG_LSN_TBL VALUES ('-1/0');
^
INSERT INTO PG_LSN_TBL VALUES (' 0/12345678');
ERROR: invalid input syntax for type pg_lsn: " 0/12345678"
LINE 1: INSERT INTO PG_LSN_TBL VALUES (' 0/12345678');
^
INSERT INTO PG_LSN_TBL VALUES ('ABCD/');
ERROR: invalid input syntax for type pg_lsn: "ABCD/"
LINE 1: INSERT INTO PG_LSN_TBL VALUES ('ABCD/');
^
INSERT INTO PG_LSN_TBL VALUES ('/ABCD');
ERROR: invalid input syntax for type pg_lsn: "/ABCD"
LINE 1: INSERT INTO PG_LSN_TBL VALUES ('/ABCD');
^
DROP TABLE PG_LSN_TBL;
-- Operators
SELECT '0/16AE7F8' = '0/16AE7F8'::pg_lsn;
?column?
----------
t
(1 row)
SELECT '0/16AE7F8'::pg_lsn != '0/16AE7F7';
?column?
----------
t
(1 row)
SELECT '0/16AE7F7' < '0/16AE7F8'::pg_lsn;
?column?
----------
t
(1 row)
SELECT '0/16AE7F8' > pg_lsn '0/16AE7F7';
?column?
----------
t
(1 row)
SELECT '0/16AE7F7'::pg_lsn - '0/16AE7F8'::pg_lsn;
?column?
----------
-1
(1 row)
SELECT '0/16AE7F8'::pg_lsn - '0/16AE7F7'::pg_lsn;
?column?
----------
1
(1 row)
-- Check btree and hash opclasses
EXPLAIN (COSTS OFF)
SELECT DISTINCT (i || '/' || j)::pg_lsn f
FROM generate_series(1, 10) i,
generate_series(1, 10) j,
generate_series(1, 5) k
WHERE i <= 10 AND j > 0 AND j <= 10
ORDER BY f;
QUERY PLAN
--------------------------------------------------------------------------
Sort
Sort Key: (((((i.i)::text || '/'::text) || (j.j)::text))::pg_lsn)
-> HashAggregate
Group Key: ((((i.i)::text || '/'::text) || (j.j)::text))::pg_lsn
-> Nested Loop
-> Function Scan on generate_series k
-> Materialize
-> Nested Loop
-> Function Scan on generate_series j
Filter: ((j > 0) AND (j <= 10))
-> Function Scan on generate_series i
Filter: (i <= 10)
(12 rows)
SELECT DISTINCT (i || '/' || j)::pg_lsn f
FROM generate_series(1, 10) i,
generate_series(1, 10) j,
generate_series(1, 5) k
WHERE i <= 10 AND j > 0 AND j <= 10
ORDER BY f;
f
-------
1/1
1/2
1/3
1/4
1/5
1/6
1/7
1/8
1/9
1/10
2/1
2/2
2/3
2/4
2/5
2/6
2/7
2/8
2/9
2/10
3/1
3/2
3/3
3/4
3/5
3/6
3/7
3/8
3/9
3/10
4/1
4/2
4/3
4/4
4/5
4/6
4/7
4/8
4/9
4/10
5/1
5/2
5/3
5/4
5/5
5/6
5/7
5/8
5/9
5/10
6/1
6/2
6/3
6/4
6/5
6/6
6/7
6/8
6/9
6/10
7/1
7/2
7/3
7/4
7/5
7/6
7/7
7/8
7/9
7/10
8/1
8/2
8/3
8/4
8/5
8/6
8/7
8/8
8/9
8/10
9/1
9/2
9/3
9/4
9/5
9/6
9/7
9/8
9/9
9/10
10/1
10/2
10/3
10/4
10/5
10/6
10/7
10/8
10/9
10/10
(100 rows)