Skip to content
Snippets Groups Projects
Commit 8ae10f0c authored by Michael Paquier's avatar Michael Paquier
Browse files

wal_utils: Improve regression tests

Instead of some weird COPY and string aggregates, just hardcode the
history file contents, this is enough to validate the code.
parent c727beaf
No related branches found
No related tags found
No related merge requests found
1 0/09D4F390 no recovery target specified
2 0/117BEB70 no recovery target specified
3 0/187BEB38 no recovery target specified
4 0/188BEB38 no recovery target specified
5 0/189BEB38 no recovery target specified
7 0/249BEB38 no recovery target specified
# Ignore all generated output
/parse_wal_history.out
Loading
Loading
@@ -3,19 +3,18 @@ CREATE EXTENSION wal_utils;
CREATE TABLE history_data (data text);
-- Note that COPY truncates newlines.
-- Load history file that succeeds
COPY history_data FROM '@abs_srcdir@/data/example_success.history' WITH (FORMAT csv);
SELECT string_agg(data, E'\n') FROM history_data;
string_agg
------------------------------------------------------
1 0/09D4F390 no recovery target specified+
2 0/117BEB70 no recovery target specified+
3 0/187BEB38 no recovery target specified+
4 0/188BEB38 no recovery target specified+
5 0/189BEB38 no recovery target specified+
7 0/249BEB38 no recovery target specified
(1 row)
INSERT INTO history_data VALUES (
'# Ignore this comment
1 0/09D4F390 no recovery target specified
2 0/117BEB70 no recovery target specified
3 0/187BEB38 no recovery target specified
# Other this comment and empty line
 
SELECT parse_wal_history(string_agg(data, E'\n')) FROM history_data;
4 0/188BEB38 no recovery target specified
5 0/189BEB38 no recovery target specified
7 0/249BEB38 no recovery target specified
');
SELECT parse_wal_history(data) FROM history_data;
parse_wal_history
---------------------------
(1,,0/9D4F390)
Loading
Loading
-- Install extension for tests
CREATE EXTENSION wal_utils;
CREATE TABLE history_data (data text);
-- Note that COPY truncates newlines.
-- Load history file that succeeds
COPY history_data FROM '@abs_srcdir@/data/example_success.history' WITH (FORMAT csv);
SELECT string_agg(data, E'\n') FROM history_data;
SELECT parse_wal_history(string_agg(data, E'\n')) FROM history_data;
DROP TABLE history_data;
# Ignore all generated input
/parse_wal_history.sql
-- Install extension for tests
CREATE EXTENSION wal_utils;
CREATE TABLE history_data (data text);
-- Note that COPY truncates newlines.
-- Load history file that succeeds
INSERT INTO history_data VALUES (
'# Ignore this comment
1 0/09D4F390 no recovery target specified
2 0/117BEB70 no recovery target specified
3 0/187BEB38 no recovery target specified
# Other this comment and empty line
4 0/188BEB38 no recovery target specified
5 0/189BEB38 no recovery target specified
7 0/249BEB38 no recovery target specified
');
SELECT parse_wal_history(data) FROM history_data;
DROP TABLE history_data;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment