4 CREATE TABLE PG_LSN_TBL (f1 pg_lsn);
5 -- Largest and smallest input
6 INSERT INTO PG_LSN_TBL VALUES ('0/0');
7 INSERT INTO PG_LSN_TBL VALUES ('FFFFFFFF/FFFFFFFF');
9 INSERT INTO PG_LSN_TBL VALUES ('G/0');
10 ERROR: invalid input syntax for type pg_lsn: "G/0"
11 LINE 1: INSERT INTO PG_LSN_TBL VALUES ('G/0');
13 INSERT INTO PG_LSN_TBL VALUES ('-1/0');
14 ERROR: invalid input syntax for type pg_lsn: "-1/0"
15 LINE 1: INSERT INTO PG_LSN_TBL VALUES ('-1/0');
17 INSERT INTO PG_LSN_TBL VALUES (' 0/12345678');
18 ERROR: invalid input syntax for type pg_lsn: " 0/12345678"
19 LINE 1: INSERT INTO PG_LSN_TBL VALUES (' 0/12345678');
21 INSERT INTO PG_LSN_TBL VALUES ('ABCD/');
22 ERROR: invalid input syntax for type pg_lsn: "ABCD/"
23 LINE 1: INSERT INTO PG_LSN_TBL VALUES ('ABCD/');
25 INSERT INTO PG_LSN_TBL VALUES ('/ABCD');
26 ERROR: invalid input syntax for type pg_lsn: "/ABCD"
27 LINE 1: INSERT INTO PG_LSN_TBL VALUES ('/ABCD');
29 -- Min/Max aggregation
30 SELECT MIN(f1), MAX(f1) FROM PG_LSN_TBL;
32 -----+-------------------
33 0/0 | FFFFFFFF/FFFFFFFF
36 DROP TABLE PG_LSN_TBL;
38 SELECT '0/16AE7F8' = '0/16AE7F8'::pg_lsn;
44 SELECT '0/16AE7F8'::pg_lsn != '0/16AE7F7';
50 SELECT '0/16AE7F7' < '0/16AE7F8'::pg_lsn;
56 SELECT '0/16AE7F8' > pg_lsn '0/16AE7F7';
62 SELECT '0/16AE7F7'::pg_lsn - '0/16AE7F8'::pg_lsn;
68 SELECT '0/16AE7F8'::pg_lsn - '0/16AE7F7'::pg_lsn;
74 SELECT '0/16AE7F7'::pg_lsn + 16::numeric;
80 SELECT 16::numeric + '0/16AE7F7'::pg_lsn;
86 SELECT '0/16AE7F7'::pg_lsn - 16::numeric;
92 SELECT 'FFFFFFFF/FFFFFFFE'::pg_lsn + 1::numeric;
98 SELECT 'FFFFFFFF/FFFFFFFE'::pg_lsn + 2::numeric; -- out of range error
99 ERROR: pg_lsn out of range
100 SELECT '0/1'::pg_lsn - 1::numeric;
106 SELECT '0/1'::pg_lsn - 2::numeric; -- out of range error
107 ERROR: pg_lsn out of range
108 SELECT '0/0'::pg_lsn + ('FFFFFFFF/FFFFFFFF'::pg_lsn - '0/0'::pg_lsn);
114 SELECT 'FFFFFFFF/FFFFFFFF'::pg_lsn - ('FFFFFFFF/FFFFFFFF'::pg_lsn - '0/0'::pg_lsn);
120 SELECT '0/16AE7F7'::pg_lsn + 'NaN'::numeric;
121 ERROR: cannot add NaN to pg_lsn
122 SELECT '0/16AE7F7'::pg_lsn - 'NaN'::numeric;
123 ERROR: cannot subtract NaN from pg_lsn
124 -- Check btree and hash opclasses
126 SELECT DISTINCT (i || '/' || j)::pg_lsn f
127 FROM generate_series(1, 10) i,
128 generate_series(1, 10) j,
129 generate_series(1, 5) k
130 WHERE i <= 10 AND j > 0 AND j <= 10
133 --------------------------------------------------------------------------
135 Sort Key: (((((i.i)::text || '/'::text) || (j.j)::text))::pg_lsn)
137 Group Key: ((((i.i)::text || '/'::text) || (j.j)::text))::pg_lsn
139 -> Function Scan on generate_series k
142 -> Function Scan on generate_series j
143 Filter: ((j > 0) AND (j <= 10))
144 -> Function Scan on generate_series i
148 SELECT DISTINCT (i || '/' || j)::pg_lsn f
149 FROM generate_series(1, 10) i,
150 generate_series(1, 10) j,
151 generate_series(1, 5) k
152 WHERE i <= 10 AND j > 0 AND j <= 10