summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorRobert Haas2014-02-19 13:35:23 +0000
committerRobert Haas2014-02-19 13:35:23 +0000
commit7d03a83f4d0736ba869fa6f93973f7623a27038a (patch)
treed1d7f36c742fcea38edbbf7eb623cca2a52c1378 /src/test
parenta222f7fda6a04ab8ec655cd5a9de5ff70ff916c3 (diff)
Add a pg_lsn data type, to represent an LSN.
Robert Haas and Michael Paquier
Diffstat (limited to 'src/test')
-rw-r--r--src/test/regress/expected/pg_lsn.out62
-rw-r--r--src/test/regress/parallel_schedule2
-rw-r--r--src/test/regress/serial_schedule1
-rw-r--r--src/test/regress/sql/pg_lsn.sql25
4 files changed, 89 insertions, 1 deletions
diff --git a/src/test/regress/expected/pg_lsn.out b/src/test/regress/expected/pg_lsn.out
new file mode 100644
index 00000000000..50258f7ef19
--- /dev/null
+++ b/src/test/regress/expected/pg_lsn.out
@@ -0,0 +1,62 @@
+--
+-- 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 transaction log location: "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 transaction log location: "-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 transaction log location: " 0/12345678"
+LINE 1: INSERT INTO PG_LSN_TBL VALUES (' 0/12345678');
+ ^
+INSERT INTO PG_LSN_TBL VALUES ('ABCD/');
+ERROR: invalid input syntax for transaction log location: "ABCD/"
+LINE 1: INSERT INTO PG_LSN_TBL VALUES ('ABCD/');
+ ^
+INSERT INTO PG_LSN_TBL VALUES ('/ABCD');
+ERROR: invalid input syntax for transaction log location: "/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; -- No negative results
+ERROR: transaction log location out of range
+SELECT '0/16AE7F8'::pg_lsn - '0/16AE7F7'::pg_lsn; -- correct
+ ?column?
+----------
+ 1
+(1 row)
+
diff --git a/src/test/regress/parallel_schedule b/src/test/regress/parallel_schedule
index 5758b07fa42..2e3eba83dee 100644
--- a/src/test/regress/parallel_schedule
+++ b/src/test/regress/parallel_schedule
@@ -13,7 +13,7 @@ test: tablespace
# ----------
# The first group of parallel tests
# ----------
-test: boolean char name varchar text int2 int4 int8 oid float4 float8 bit numeric txid uuid enum money rangetypes
+test: boolean char name varchar text int2 int4 int8 oid float4 float8 bit numeric txid uuid enum money rangetypes pg_lsn
# Depends on things setup during char, varchar and text
test: strings
diff --git a/src/test/regress/serial_schedule b/src/test/regress/serial_schedule
index 78348f5f865..4f1dedec2b5 100644
--- a/src/test/regress/serial_schedule
+++ b/src/test/regress/serial_schedule
@@ -19,6 +19,7 @@ test: uuid
test: enum
test: money
test: rangetypes
+test: pg_lsn
test: strings
test: numerology
test: point
diff --git a/src/test/regress/sql/pg_lsn.sql b/src/test/regress/sql/pg_lsn.sql
new file mode 100644
index 00000000000..dddafb32f71
--- /dev/null
+++ b/src/test/regress/sql/pg_lsn.sql
@@ -0,0 +1,25 @@
+--
+-- 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');
+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; -- No negative results
+SELECT '0/16AE7F8'::pg_lsn - '0/16AE7F7'::pg_lsn; -- correct