summaryrefslogtreecommitdiffstats
path: root/src/test/regress/sql/pg_lsn.sql
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:19:15 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:19:15 +0000
commit6eb9c5a5657d1fe77b55cc261450f3538d35a94d (patch)
tree657d8194422a5daccecfd42d654b8a245ef7b4c8 /src/test/regress/sql/pg_lsn.sql
parentInitial commit. (diff)
downloadpostgresql-13-6eb9c5a5657d1fe77b55cc261450f3538d35a94d.tar.xz
postgresql-13-6eb9c5a5657d1fe77b55cc261450f3538d35a94d.zip
Adding upstream version 13.4.upstream/13.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/regress/sql/pg_lsn.sql')
-rw-r--r--src/test/regress/sql/pg_lsn.sql45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/test/regress/sql/pg_lsn.sql b/src/test/regress/sql/pg_lsn.sql
new file mode 100644
index 0000000..2c143c8
--- /dev/null
+++ b/src/test/regress/sql/pg_lsn.sql
@@ -0,0 +1,45 @@
+--
+-- 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');
+INSERT INTO PG_LSN_TBL VALUES ('-1/0');
+INSERT INTO PG_LSN_TBL VALUES (' 0/12345678');
+INSERT INTO PG_LSN_TBL VALUES ('ABCD/');
+INSERT INTO PG_LSN_TBL VALUES ('/ABCD');
+
+-- Min/Max aggregation
+SELECT MIN(f1), MAX(f1) FROM PG_LSN_TBL;
+
+DROP TABLE PG_LSN_TBL;
+
+-- Operators
+SELECT '0/16AE7F8' = '0/16AE7F8'::pg_lsn;
+SELECT '0/16AE7F8'::pg_lsn != '0/16AE7F7';
+SELECT '0/16AE7F7' < '0/16AE7F8'::pg_lsn;
+SELECT '0/16AE7F8' > pg_lsn '0/16AE7F7';
+SELECT '0/16AE7F7'::pg_lsn - '0/16AE7F8'::pg_lsn;
+SELECT '0/16AE7F8'::pg_lsn - '0/16AE7F7'::pg_lsn;
+
+-- 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;
+
+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;