Skip to content

Commit

Permalink
Support type name with modifier
Browse files Browse the repository at this point in the history
Issue yugabyte#31 asked for type name with type modifier (if available). This
commit implemented type modifier inclusion by default. It is possible to
use the old type name, if you use the option 'include-typmod' as 'false'.

I'll change the regression tests to use the new format later. I've added
a new test (typmod) to exercise this new option.
  • Loading branch information
Euler Taveira committed Oct 21, 2017
1 parent c196c32 commit 0255f2a
Show file tree
Hide file tree
Showing 30 changed files with 231 additions and 30 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ MODULES = wal2json

# message test will fail for <= 9.5
REGRESS = cmdline insert1 update1 update2 update3 update4 delete1 delete2 \
delete3 delete4 savepoint specialvalue toast bytea message
delete3 delete4 savepoint specialvalue toast bytea message typmod

PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
Expand Down
2 changes: 1 addition & 1 deletion expected/bytea.out

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion expected/delete1.out
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ DELETE FROM table_without_pk WHERE b = 1;
DELETE FROM table_with_pk WHERE b = 1;
-- DELETE: unique
DELETE FROM table_with_unique WHERE b = 1;
SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'pretty-print', '1');
SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'pretty-print', '1', 'include-typmod', '0');
WARNING: table "table_without_pk" without primary key or replica identity is nothing
WARNING: table "table_with_unique" without primary key or replica identity is nothing
data
Expand Down
2 changes: 1 addition & 1 deletion expected/delete2.out
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ ALTER TABLE table_without_pk REPLICA IDENTITY DEFAULT;
ALTER TABLE table_with_unique REPLICA IDENTITY NOTHING;
DELETE FROM table_with_unique WHERE b = 1;
ALTER TABLE table_with_unique REPLICA IDENTITY DEFAULT;
SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'pretty-print', '1');
SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'pretty-print', '1', 'include-typmod', '0');
WARNING: table "table_with_pk" without primary key or replica identity is nothing
WARNING: table "table_without_pk" without primary key or replica identity is nothing
WARNING: table "table_with_unique" without primary key or replica identity is nothing
Expand Down
2 changes: 1 addition & 1 deletion expected/delete3.out
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ ALTER TABLE table_without_pk REPLICA IDENTITY DEFAULT;
ALTER TABLE table_with_unique REPLICA IDENTITY FULL;
DELETE FROM table_with_unique WHERE b = 1;
ALTER TABLE table_with_unique REPLICA IDENTITY DEFAULT;
SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'pretty-print', '1');
SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'pretty-print', '1', 'include-typmod', '0');
data
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
{ +
Expand Down
2 changes: 1 addition & 1 deletion expected/delete4.out
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ ALTER TABLE table_with_unique REPLICA IDENTITY USING INDEX table_with_unique_g_n
DELETE FROM table_with_unique WHERE b = 1;
DELETE FROM table_with_unique WHERE n = true;
ALTER TABLE table_with_unique REPLICA IDENTITY DEFAULT;
SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'pretty-print', '1');
SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'pretty-print', '1', 'include-typmod', '0');
data
-----------------------------------------------------------------
{ +
Expand Down
2 changes: 1 addition & 1 deletion expected/insert1.out
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ INSERT INTO table_with_pk (b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) VALUES(1
INSERT INTO table_without_pk (b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) VALUES(1, 2, 3, 3.54, 876.563452345, 1.23, 'teste', 'testando', 'um texto longo', B'001110010101010', '2013-11-02 17:30:52', '2013-02-04', true, '{ "a": 123 }', 'Old Old Parr'::tsvector);
INSERT INTO table_with_unique (b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) VALUES(1, 2, 3, 3.54, 876.563452345, 1.23, 'teste', 'testando', 'um texto longo', B'001110010101010', '2013-11-02 17:30:52', '2013-02-04', true, '{ "a": 123 }', 'Old Old Parr'::tsvector);
COMMIT;
SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'pretty-print', '1');
SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'pretty-print', '1', 'include-typmod', '0');
data
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
{ +
Expand Down
2 changes: 1 addition & 1 deletion expected/savepoint.out
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ ROLLBACK TO SAVEPOINT sp2;
RELEASE SAVEPOINT sp1;
INSERT INTO xpto (b) VALUES('francisco');
END;
SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'pretty-print', '1');
SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'pretty-print', '1', 'include-typmod', '0');
data
----------------------------------------------------------
{ +
Expand Down
2 changes: 1 addition & 1 deletion expected/specialvalue.out
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ INSERT INTO xpto (b, c, d) VALUES('f', 'test2', 'nan');
INSERT INTO xpto (b, c, d) VALUES(NULL, 'null', '-inf');
INSERT INTO xpto (b, c, d) VALUES(TRUE, E'valid: '' " \\ / \b \f \n \r \t \u207F \u967F invalid: \\g \\k end', 123.456);
COMMIT;
SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'pretty-print', '1');
SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'pretty-print', '1', 'include-typmod', '0');
data
--------------------------------------------------------------------------------------------------------------------------
{ +
Expand Down
2 changes: 1 addition & 1 deletion expected/toast.out
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ INSERT INTO xpto (toasted_col2) SELECT repeat(string_agg(to_char(g.i, 'FM0000'),
UPDATE xpto SET toasted_col1 = (SELECT string_agg(g.i::text, '') FROM generate_series(1, 2000) g(i)) WHERE id = 1;
UPDATE xpto SET rand1 = 123.456 WHERE id = 1;
DELETE FROM xpto WHERE id = 1;
SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'pretty-print', '1');
SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'pretty-print', '1', 'include-typmod', '0');
WARNING: column "toasted_col2" has an unchanged TOAST
WARNING: column "toasted_col1" has an unchanged TOAST
WARNING: column "toasted_col2" has an unchanged TOAST
Expand Down
Loading

0 comments on commit 0255f2a

Please sign in to comment.