diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 4dd89e1..2795511 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -1417,6 +1417,10 @@ index_build(Relation heapRelation, procedure = indexRelation->rd_am->ambuild; Assert(RegProcedureIsValid(procedure)); + ereport(IsToastRelation(indexRelation) ? DEBUG2 : DEBUG1, + (errmsg("Rebuilding index \"%s\"", + RelationGetRelationName(indexRelation)))); + /* * Switch to the table owner's userid, so that any index functions are run * as that user. Also lock down security-restricted operations and diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index f3bd565..487d0ac 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -3443,6 +3443,15 @@ ATRewriteTable(AlteredTableInfo *tab, Oid OIDNewHeap, LOCKMODE lockmode) List *dropped_attrs = NIL; ListCell *lc; + if (newrel) + ereport(DEBUG1, + (errmsg("Rewriting table \"%s\"", + RelationGetRelationName(oldrel)))); + else + ereport(DEBUG1, + (errmsg("Verifying table \"%s\"", + RelationGetRelationName(oldrel)))); + econtext = GetPerTupleExprContext(estate); /* @@ -3836,6 +3845,10 @@ ATTypedTableRecursion(List **wqueue, Relation rel, AlterTableCmd *cmd, * Eventually, we'd like to propagate the check or rewrite operation * into other such tables, but for now, just error out if we find any. * + * Table, NOT NULL and DEFAULT constraints and the "oid" system column do + * not (currently) follow the row type, so they require no attention here. + * The non-propagation of DEFAULT and NOT NULL make ADD COLUMN safe, too. + * * Caller should provide either a table name or a type name (not both) to * report in the error message, if any. * @@ -5789,6 +5802,10 @@ validateForeignKeyConstraint(Constraint *fkconstraint, HeapTuple tuple; Trigger trig; + ereport(DEBUG1, + (errmsg("Validating foreign key constraint \"%s\"", + fkconstraint->conname))); + /* * Build a trigger call structure; we'll need it either way. */ diff --git a/src/test/regress/expected/alter_table.out b/src/test/regress/expected/alter_table.out index 3d126bb..387aeaf 100644 --- a/src/test/regress/expected/alter_table.out +++ b/src/test/regress/expected/alter_table.out @@ -1477,6 +1477,1796 @@ create table tab1 (a int, b text); create table tab2 (x int, y tab1); alter table tab1 alter column b type varchar; -- fails ERROR: cannot alter table "tab1" because column "tab2"."y" uses its rowtype +alter table tab1 add check (b <> 'foo'); +alter table tab1 add c int not null; +alter table tab1 add d int not null default 1; -- fails +ERROR: cannot alter table "tab1" because column "tab2"."y" uses its rowtype +alter table tab1 drop a; +alter table tab1 set with oids; -- fails +ERROR: cannot alter table "tab1" because column "tab2"."y" uses its rowtype +-- +-- Deeper alter-column-type tests +-- +SET client_min_messages = debug1; -- Track rewrites. +SET timezone = UTC; +-- Model a type change that throws the semantics of dependent expressions. +CREATE DOMAIN trickint AS int; +CREATE FUNCTION touchy_f(trickint) RETURNS int4 LANGUAGE sql AS 'SELECT 100'; +CREATE FUNCTION touchy_f(int4) RETURNS int4 LANGUAGE sql AS 'SELECT $1'; +CREATE DOMAIN loosedom AS text; +CREATE DOMAIN lendom AS varchar(10); +CREATE DOMAIN shortdom AS varchar(1); +CREATE DOMAIN checkdom AS text CHECK (VALUE LIKE 'A_'); +CREATE DOMAIN faildom AS text CHECK (VALUE LIKE 'B_'); +CREATE TABLE parent (keycol numeric PRIMARY KEY); +NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "parent_pkey" for table "parent" +DEBUG: Rebuilding index "parent_pkey" +INSERT INTO parent VALUES (1.1), (1.05), (1.15); +CREATE TABLE t ( + constraint0 int4 NOT NULL, + constraint1 int4 NOT NULL, + constraint2 int4 NOT NULL, + constraint3 numeric NOT NULL REFERENCES parent, + constraint4 numeric UNIQUE NOT NULL, + integral int4 UNIQUE NOT NULL, + rational numeric UNIQUE NOT NULL, + string varchar(2) NOT NULL, + daytimetz timetz UNIQUE NOT NULL, + daytime time UNIQUE NOT NULL, + stamptz timestamptz UNIQUE NOT NULL, + stamp timestamp UNIQUE NOT NULL, + timegap interval UNIQUE NOT NULL, + bits bit varying UNIQUE NOT NULL, + network cidr UNIQUE NOT NULL, + document xml NOT NULL, + strarr varchar(2)[] NOT NULL, + square box NOT NULL, + CHECK (touchy_f(constraint0) < 10) +); +NOTICE: CREATE TABLE / UNIQUE will create implicit index "t_constraint4_key" for table "t" +DEBUG: Rebuilding index "t_constraint4_key" +NOTICE: CREATE TABLE / UNIQUE will create implicit index "t_integral_key" for table "t" +DEBUG: Rebuilding index "t_integral_key" +NOTICE: CREATE TABLE / UNIQUE will create implicit index "t_rational_key" for table "t" +DEBUG: Rebuilding index "t_rational_key" +NOTICE: CREATE TABLE / UNIQUE will create implicit index "t_daytimetz_key" for table "t" +DEBUG: Rebuilding index "t_daytimetz_key" +NOTICE: CREATE TABLE / UNIQUE will create implicit index "t_daytime_key" for table "t" +DEBUG: Rebuilding index "t_daytime_key" +NOTICE: CREATE TABLE / UNIQUE will create implicit index "t_stamptz_key" for table "t" +DEBUG: Rebuilding index "t_stamptz_key" +NOTICE: CREATE TABLE / UNIQUE will create implicit index "t_stamp_key" for table "t" +DEBUG: Rebuilding index "t_stamp_key" +NOTICE: CREATE TABLE / UNIQUE will create implicit index "t_timegap_key" for table "t" +DEBUG: Rebuilding index "t_timegap_key" +NOTICE: CREATE TABLE / UNIQUE will create implicit index "t_bits_key" for table "t" +DEBUG: Rebuilding index "t_bits_key" +NOTICE: CREATE TABLE / UNIQUE will create implicit index "t_network_key" for table "t" +DEBUG: Rebuilding index "t_network_key" +CREATE INDEX ON t (string); +DEBUG: Rebuilding index "t_string_idx" +CREATE INDEX ON t USING hash (string); +DEBUG: Rebuilding index "t_string_idx1" +CREATE INDEX ON t USING gin (strarr); +DEBUG: Rebuilding index "t_strarr_idx" +CREATE INDEX ON t USING gist (square); +DEBUG: Rebuilding index "t_square_idx" +CREATE UNIQUE INDEX ON t ((touchy_f(constraint1))); +DEBUG: Rebuilding index "t_touchy_f_idx" +CREATE UNIQUE INDEX ON t ((1)) WHERE touchy_f(constraint2) = 100; +DEBUG: Rebuilding index "t_expr_idx" +INSERT INTO t VALUES +( + 1, + 2, + 3, + 1.05, + 1.06, + 4, + 10.12, + 'AB', + '8:44:00.19', + '8:44:00.29', + '2000-01-01 08:44:00.39', + '2000-01-01 08:44:00.49', + '00:00:01.59', + '011101', + '10.0.0.0/16', + '', + '{ab,cd}', + '(1,1),(0,0)' +), +( + 2, + 3, + 4, + 1.15, + 1.16, + 5, + 11.12, + 'AC', + '9:44:00.19', + '9:44:00.29', + '2000-01-01 09:44:00.39', + '2000-01-01 09:44:00.49', + '00:00:02.59', + '001101', + '10.1.0.0/16', + '', + '{ef,gh}', + '(2,2),(0,0)' +); +CREATE TABLE child (keycol numeric PRIMARY KEY REFERENCES t(constraint4)); +NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "child_pkey" for table "child" +DEBUG: Rebuilding index "child_pkey" +INSERT INTO child VALUES (1.06), (1.16); +-- Data and catalog begin state. Keep this synchronized with the copy below. +SELECT * FROM t ORDER BY 1; + constraint0 | constraint1 | constraint2 | constraint3 | constraint4 | integral | rational | string | daytimetz | daytime | stamptz | stamp | timegap | bits | network | document | strarr | square +-------------+-------------+-------------+-------------+-------------+----------+----------+--------+----------------+-------------+---------------------------------+-----------------------------+-------------+--------+-------------+----------+---------+------------- + 1 | 2 | 3 | 1.05 | 1.06 | 4 | 10.12 | AB | 08:44:00.19+00 | 08:44:00.29 | Sat Jan 01 08:44:00.39 2000 UTC | Sat Jan 01 08:44:00.49 2000 | @ 1.59 secs | 011101 | 10.0.0.0/16 | | {ab,cd} | (1,1),(0,0) + 2 | 3 | 4 | 1.15 | 1.16 | 5 | 11.12 | AC | 09:44:00.19+00 | 09:44:00.29 | Sat Jan 01 09:44:00.39 2000 UTC | Sat Jan 01 09:44:00.49 2000 | @ 2.59 secs | 001101 | 10.1.0.0/16 | | {ef,gh} | (2,2),(0,0) +(2 rows) + +SELECT relname, relnamespace, relowner, relam, reltablespace, relhasindex, + relisshared, relpersistence, relkind, relnatts, relchecks, relhasoids, + relhaspkey, relhasexclusion, relhasrules, relhastriggers, relacl, + reloptions +FROM pg_class WHERE oid = 't'::regclass + OR oid IN (SELECT indexrelid FROM pg_index WHERE indrelid = 't'::regclass) +ORDER BY 1; + relname | relnamespace | relowner | relam | reltablespace | relhasindex | relisshared | relpersistence | relkind | relnatts | relchecks | relhasoids | relhaspkey | relhasexclusion | relhasrules | relhastriggers | relacl | reloptions +-------------------+--------------+----------+-------+---------------+-------------+-------------+----------------+---------+----------+-----------+------------+------------+-----------------+-------------+----------------+--------+------------ + t | 2200 | 10 | 0 | 0 | t | f | p | r | 18 | 1 | f | f | f | f | t | | + t_bits_key | 2200 | 10 | 403 | 0 | f | f | p | i | 1 | 0 | f | f | f | f | f | | + t_constraint4_key | 2200 | 10 | 403 | 0 | f | f | p | i | 1 | 0 | f | f | f | f | f | | + t_daytime_key | 2200 | 10 | 403 | 0 | f | f | p | i | 1 | 0 | f | f | f | f | f | | + t_daytimetz_key | 2200 | 10 | 403 | 0 | f | f | p | i | 1 | 0 | f | f | f | f | f | | + t_expr_idx | 2200 | 10 | 403 | 0 | f | f | p | i | 1 | 0 | f | f | f | f | f | | + t_integral_key | 2200 | 10 | 403 | 0 | f | f | p | i | 1 | 0 | f | f | f | f | f | | + t_network_key | 2200 | 10 | 403 | 0 | f | f | p | i | 1 | 0 | f | f | f | f | f | | + t_rational_key | 2200 | 10 | 403 | 0 | f | f | p | i | 1 | 0 | f | f | f | f | f | | + t_square_idx | 2200 | 10 | 783 | 0 | f | f | p | i | 1 | 0 | f | f | f | f | f | | + t_stamp_key | 2200 | 10 | 403 | 0 | f | f | p | i | 1 | 0 | f | f | f | f | f | | + t_stamptz_key | 2200 | 10 | 403 | 0 | f | f | p | i | 1 | 0 | f | f | f | f | f | | + t_strarr_idx | 2200 | 10 | 2742 | 0 | f | f | p | i | 1 | 0 | f | f | f | f | f | | + t_string_idx | 2200 | 10 | 403 | 0 | f | f | p | i | 1 | 0 | f | f | f | f | f | | + t_string_idx1 | 2200 | 10 | 405 | 0 | f | f | p | i | 1 | 0 | f | f | f | f | f | | + t_timegap_key | 2200 | 10 | 403 | 0 | f | f | p | i | 1 | 0 | f | f | f | f | f | | + t_touchy_f_idx | 2200 | 10 | 403 | 0 | f | f | p | i | 1 | 0 | f | f | f | f | f | | +(17 rows) + +SELECT relname, indnatts, indisunique, indisprimary, indimmediate, + indisclustered, indisvalid, indcheckxmin, indisready, indkey, indclass, + indoption +FROM pg_index JOIN pg_class c ON c.oid = indexrelid +WHERE indrelid = 't'::regclass ORDER BY 1; + relname | indnatts | indisunique | indisprimary | indimmediate | indisclustered | indisvalid | indcheckxmin | indisready | indkey | indclass | indoption +-------------------+----------+-------------+--------------+--------------+----------------+------------+--------------+------------+--------+----------+----------- + t_bits_key | 1 | t | f | t | f | t | f | t | 14 | 10051 | 0 + t_constraint4_key | 1 | t | f | t | f | t | f | t | 5 | 10037 | 0 + t_daytime_key | 1 | t | f | t | f | t | f | t | 10 | 10045 | 0 + t_daytimetz_key | 1 | t | f | t | f | t | f | t | 9 | 10049 | 0 + t_expr_idx | 1 | t | f | t | f | t | f | t | 0 | 1978 | 0 + t_integral_key | 1 | t | f | t | f | t | f | t | 6 | 1978 | 0 + t_network_key | 1 | t | f | t | f | t | f | t | 15 | 10025 | 0 + t_rational_key | 1 | t | f | t | f | t | f | t | 7 | 10037 | 0 + t_square_idx | 1 | f | f | t | f | t | f | t | 18 | 10074 | 0 + t_stamp_key | 1 | t | f | t | f | t | f | t | 12 | 10054 | 0 + t_stamptz_key | 1 | t | f | t | f | t | f | t | 11 | 10047 | 0 + t_strarr_idx | 1 | f | f | t | f | t | f | t | 17 | 10103 | 0 + t_string_idx | 1 | f | f | t | f | t | f | t | 8 | 10043 | 0 + t_string_idx1 | 1 | f | f | t | f | t | f | t | 8 | 10044 | 0 + t_timegap_key | 1 | t | f | t | f | t | f | t | 13 | 10031 | 0 + t_touchy_f_idx | 1 | t | f | t | f | t | f | t | 0 | 1978 | 0 +(16 rows) + +SELECT relname, attname, atttypid, attstattarget, attlen, attnum, attndims, + attcacheoff, atttypmod, attbyval, attstorage, attalign, attnotnull, + atthasdef, attisdropped, attislocal, attinhcount, attacl, attoptions +FROM pg_attribute JOIN pg_class c ON c.oid = attrelid +WHERE attrelid = 't'::regclass OR + attrelid IN (SELECT indexrelid FROM pg_index WHERE indrelid = 't'::regclass) +ORDER BY 1, 2; + relname | attname | atttypid | attstattarget | attlen | attnum | attndims | attcacheoff | atttypmod | attbyval | attstorage | attalign | attnotnull | atthasdef | attisdropped | attislocal | attinhcount | attacl | attoptions +-------------------+-------------+----------+---------------+--------+--------+----------+-------------+-----------+----------+------------+----------+------------+-----------+--------------+------------+-------------+--------+------------ + t | bits | 1562 | -1 | -1 | 14 | 0 | -1 | -1 | f | x | i | t | f | f | t | 0 | | + t | cmax | 29 | 0 | 4 | -6 | 0 | -1 | -1 | t | p | i | t | f | f | t | 0 | | + t | cmin | 29 | 0 | 4 | -4 | 0 | -1 | -1 | t | p | i | t | f | f | t | 0 | | + t | constraint0 | 23 | -1 | 4 | 1 | 0 | -1 | -1 | t | p | i | t | f | f | t | 0 | | + t | constraint1 | 23 | -1 | 4 | 2 | 0 | -1 | -1 | t | p | i | t | f | f | t | 0 | | + t | constraint2 | 23 | -1 | 4 | 3 | 0 | -1 | -1 | t | p | i | t | f | f | t | 0 | | + t | constraint3 | 1700 | -1 | -1 | 4 | 0 | -1 | -1 | f | m | i | t | f | f | t | 0 | | + t | constraint4 | 1700 | -1 | -1 | 5 | 0 | -1 | -1 | f | m | i | t | f | f | t | 0 | | + t | ctid | 27 | 0 | 6 | -1 | 0 | -1 | -1 | f | p | s | t | f | f | t | 0 | | + t | daytime | 1083 | -1 | 8 | 10 | 0 | -1 | -1 | t | p | d | t | f | f | t | 0 | | + t | daytimetz | 1266 | -1 | 12 | 9 | 0 | -1 | -1 | f | p | d | t | f | f | t | 0 | | + t | document | 142 | -1 | -1 | 16 | 0 | -1 | -1 | f | x | i | t | f | f | t | 0 | | + t | integral | 23 | -1 | 4 | 6 | 0 | -1 | -1 | t | p | i | t | f | f | t | 0 | | + t | network | 650 | -1 | -1 | 15 | 0 | -1 | -1 | f | m | i | t | f | f | t | 0 | | + t | rational | 1700 | -1 | -1 | 7 | 0 | -1 | -1 | f | m | i | t | f | f | t | 0 | | + t | square | 603 | -1 | 32 | 18 | 0 | -1 | -1 | f | p | d | t | f | f | t | 0 | | + t | stamp | 1114 | -1 | 8 | 12 | 0 | -1 | -1 | t | p | d | t | f | f | t | 0 | | + t | stamptz | 1184 | -1 | 8 | 11 | 0 | -1 | -1 | t | p | d | t | f | f | t | 0 | | + t | strarr | 1015 | -1 | -1 | 17 | 1 | -1 | 6 | f | x | i | t | f | f | t | 0 | | + t | string | 1043 | -1 | -1 | 8 | 0 | -1 | 6 | f | x | i | t | f | f | t | 0 | | + t | tableoid | 26 | 0 | 4 | -7 | 0 | -1 | -1 | t | p | i | t | f | f | t | 0 | | + t | timegap | 1186 | -1 | 16 | 13 | 0 | -1 | -1 | f | p | d | t | f | f | t | 0 | | + t | xmax | 28 | 0 | 4 | -5 | 0 | -1 | -1 | t | p | i | t | f | f | t | 0 | | + t | xmin | 28 | 0 | 4 | -3 | 0 | -1 | -1 | t | p | i | t | f | f | t | 0 | | + t_bits_key | bits | 1562 | -1 | -1 | 1 | 0 | -1 | -1 | f | x | i | f | f | f | t | 0 | | + t_constraint4_key | constraint4 | 1700 | -1 | -1 | 1 | 0 | -1 | -1 | f | m | i | f | f | f | t | 0 | | + t_daytime_key | daytime | 1083 | -1 | 8 | 1 | 0 | -1 | -1 | t | p | d | f | f | f | t | 0 | | + t_daytimetz_key | daytimetz | 1266 | -1 | 12 | 1 | 0 | -1 | -1 | f | p | d | f | f | f | t | 0 | | + t_expr_idx | expr | 23 | -1 | 4 | 1 | 0 | -1 | -1 | t | p | i | f | f | f | t | 0 | | + t_integral_key | integral | 23 | -1 | 4 | 1 | 0 | -1 | -1 | t | p | i | f | f | f | t | 0 | | + t_network_key | network | 650 | -1 | -1 | 1 | 0 | -1 | -1 | f | m | i | f | f | f | t | 0 | | + t_rational_key | rational | 1700 | -1 | -1 | 1 | 0 | -1 | -1 | f | m | i | f | f | f | t | 0 | | + t_square_idx | square | 603 | -1 | 32 | 1 | 0 | -1 | -1 | f | p | d | f | f | f | t | 0 | | + t_stamp_key | stamp | 1114 | -1 | 8 | 1 | 0 | -1 | -1 | t | p | d | f | f | f | t | 0 | | + t_stamptz_key | stamptz | 1184 | -1 | 8 | 1 | 0 | -1 | -1 | t | p | d | f | f | f | t | 0 | | + t_strarr_idx | strarr | 1043 | -1 | -1 | 1 | 1 | -1 | -1 | f | x | i | f | f | f | t | 0 | | + t_string_idx | string | 1043 | -1 | -1 | 1 | 0 | -1 | 6 | f | x | i | f | f | f | t | 0 | | + t_string_idx1 | string | 23 | -1 | 4 | 1 | 0 | -1 | -1 | t | p | i | f | f | f | t | 0 | | + t_timegap_key | timegap | 1186 | -1 | 16 | 1 | 0 | -1 | -1 | f | p | d | f | f | f | t | 0 | | + t_touchy_f_idx | touchy_f | 23 | -1 | 4 | 1 | 0 | -1 | -1 | t | p | i | f | f | f | t | 0 | | +(40 rows) + +SELECT conname, connamespace, contype, condeferrable, condeferred, confupdtype, + confdeltype, confmatchtype, conislocal, coninhcount, conkey, confkey, + conpfeqop, conppeqop, conffeqop, conexclop, consrc +FROM pg_constraint WHERE conrelid = 't'::regclass +ORDER BY 1; + conname | connamespace | contype | condeferrable | condeferred | confupdtype | confdeltype | confmatchtype | conislocal | coninhcount | conkey | confkey | conpfeqop | conppeqop | conffeqop | conexclop | consrc +---------------------+--------------+---------+---------------+-------------+-------------+-------------+---------------+------------+-------------+--------+---------+-----------+-----------+-----------+-----------+------------------------------ + t_bits_key | 2200 | u | f | f | | | | t | 0 | {14} | | | | | | + t_constraint0_check | 2200 | c | f | f | | | | t | 0 | {1} | | | | | | (touchy_f(constraint0) < 10) + t_constraint3_fkey | 2200 | f | f | f | a | a | u | t | 0 | {4} | {1} | {1752} | {1752} | {1752} | | + t_constraint4_key | 2200 | u | f | f | | | | t | 0 | {5} | | | | | | + t_daytime_key | 2200 | u | f | f | | | | t | 0 | {10} | | | | | | + t_daytimetz_key | 2200 | u | f | f | | | | t | 0 | {9} | | | | | | + t_integral_key | 2200 | u | f | f | | | | t | 0 | {6} | | | | | | + t_network_key | 2200 | u | f | f | | | | t | 0 | {15} | | | | | | + t_rational_key | 2200 | u | f | f | | | | t | 0 | {7} | | | | | | + t_stamp_key | 2200 | u | f | f | | | | t | 0 | {12} | | | | | | + t_stamptz_key | 2200 | u | f | f | | | | t | 0 | {11} | | | | | | + t_timegap_key | 2200 | u | f | f | | | | t | 0 | {13} | | | | | | +(12 rows) + +-- RI trigger names include the table OID. We don't have a great sort order +-- available, but tgname probably serves acceptably in practice. +SELECT tgfoid, tgtype, tgenabled, tgisinternal, tgdeferrable, tginitdeferred, + tgnargs, tgattr, tgargs, tgqual +FROM pg_trigger WHERE tgrelid = 't'::regclass ORDER BY tgname; + tgfoid | tgtype | tgenabled | tgisinternal | tgdeferrable | tginitdeferred | tgnargs | tgattr | tgargs | tgqual +--------+--------+-----------+--------------+--------------+----------------+---------+--------+--------+-------- + 1644 | 5 | O | t | f | f | 0 | | \x | + 1645 | 17 | O | t | f | f | 0 | | \x | + 1654 | 9 | O | t | f | f | 0 | | \x | + 1655 | 17 | O | t | f | f | 0 | | \x | +(4 rows) + +-- Comments "rewrite", "verify" and "noop" signify whether ATRewriteTables +-- rewrites, scans or does nothing to the table proper. An "-e" suffix denotes +-- an error outcome. A "-v" suffix means that the rewrite does not actually +-- change data, but we did it anyway out of an inability to prove that in +-- advance. Decisions to rebuild indexes or recheck foreign keys are notable, +-- though mostly not stated here. +-- Constraint failures induced by a no-work type change. +ALTER TABLE t ALTER constraint0 TYPE trickint; -- verify-e +DEBUG: Rewriting table "t" +ERROR: check constraint "t_constraint0_check" is violated by some row +ALTER TABLE t ALTER constraint1 TYPE trickint; -- noop-e +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +ALTER TABLE t ALTER constraint2 TYPE trickint; -- noop-e +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +-- Temporary fixup until behavior of the previous two improves. +ALTER TABLE t ALTER constraint1 TYPE int, ALTER constraint2 TYPE int; +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +-- Change a column with an outgoing foreign key constraint. +ALTER TABLE t ALTER constraint3 TYPE numeric(8,1); -- rewrite, FK error +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Validating foreign key constraint "t_constraint3_fkey" +ERROR: insert or update on table "t" violates foreign key constraint "t_constraint3_fkey" +DETAIL: Key (constraint3)=(1.2) is not present in table "parent". +ALTER TABLE t ALTER constraint3 TYPE numeric(8,2); -- rewrite, FK verify +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Validating foreign key constraint "t_constraint3_fkey" +ALTER TABLE t ALTER constraint3 TYPE numeric(7,2); -- verify; FK noop +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Validating foreign key constraint "t_constraint3_fkey" +ALTER TABLE t ALTER constraint3 TYPE numeric(9,2); -- noop; FK noop +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Validating foreign key constraint "t_constraint3_fkey" +-- Change a column with an incoming foreign key constraint. +ALTER TABLE t ALTER constraint4 TYPE numeric(8,1); -- rewrite; FK error +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Validating foreign key constraint "child_keycol_fkey" +ERROR: insert or update on table "child" violates foreign key constraint "child_keycol_fkey" +DETAIL: Key (keycol)=(1.06) is not present in table "t". +ALTER TABLE t ALTER constraint4 TYPE numeric(8,2); -- rewrite; FK verify +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Validating foreign key constraint "child_keycol_fkey" +ALTER TABLE t ALTER constraint4 TYPE numeric(7,2); -- verify; FK noop +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Validating foreign key constraint "child_keycol_fkey" +ALTER TABLE t ALTER constraint4 TYPE numeric(9,2); -- noop; FK noop +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Validating foreign key constraint "child_keycol_fkey" +-- Type-specific tests. +ALTER TABLE t ALTER integral TYPE abstime USING integral::abstime; -- noop +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +ALTER TABLE t ALTER integral TYPE oid USING integral::int4; -- noop +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +ALTER TABLE t ALTER integral TYPE regtype; -- noop +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +ALTER TABLE t ALTER integral TYPE int8; -- rewrite +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +ALTER TABLE t ALTER integral TYPE int2; -- rewrite +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +ALTER TABLE t ALTER rational TYPE numeric(10,2); -- rewrite-v +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +ALTER TABLE t ALTER rational TYPE numeric(12,4); -- rewrite +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +ALTER TABLE t ALTER rational TYPE numeric(13,4); -- noop +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +ALTER TABLE t ALTER rational TYPE numeric(11,4); -- verify +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +ALTER TABLE t ALTER rational TYPE numeric; -- noop +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +ALTER TABLE t ALTER rational TYPE numeric(5,4); -- verify-e +DEBUG: Rewriting table "t" +ERROR: numeric field overflow +DETAIL: A field with precision 5, scale 4 must round to an absolute value less than 10^1. +ALTER TABLE t ALTER rational TYPE numeric(4,3); -- rewrite-e +DEBUG: Rewriting table "t" +ERROR: numeric field overflow +DETAIL: A field with precision 4, scale 3 must round to an absolute value less than 10^1. +ALTER TABLE t ALTER string TYPE varchar(4); -- noop +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_string_idx" +ALTER TABLE t ALTER string TYPE lendom; -- noop +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_string_idx1" +ALTER TABLE t ALTER string TYPE shortdom; -- rewrite-e +DEBUG: Rewriting table "t" +ERROR: value too long for type character varying(1) +ALTER TABLE t ALTER string TYPE checkdom; -- verify +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_string_idx" +ALTER TABLE t ALTER string TYPE faildom; -- verify-e +DEBUG: Rewriting table "t" +ERROR: value for domain faildom violates check constraint "faildom_check" +ALTER TABLE t ALTER string TYPE loosedom; -- noop +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_string_idx1" +ALTER TABLE t ALTER string TYPE text; -- noop +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_string_idx" +ALTER TABLE t ALTER string TYPE varchar(20); -- rewrite-v +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_string_idx1" +ALTER TABLE t ALTER string TYPE varchar(1); -- rewrite-e +DEBUG: Rewriting table "t" +ERROR: value too long for type character varying(1) +ALTER TABLE t ALTER string TYPE varchar(1) USING t::varchar(1); -- rewrite +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_string_idx" +ALTER TABLE t ALTER string TYPE text USING 'foo'::varchar; -- rewrite +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_string_idx1" +ALTER TABLE t ALTER string TYPE char(3); -- rewrite-v +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_string_idx" +ALTER TABLE t ALTER string TYPE char(2); -- rewrite-e +DEBUG: Rewriting table "t" +ERROR: value too long for type character(2) +ALTER TABLE t ALTER string TYPE char(2) USING string::char(2); -- rewrite +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_string_idx1" +ALTER TABLE t ALTER string TYPE char(4); -- rewrite +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_string_idx" +ALTER TABLE t ALTER daytimetz TYPE timetz(3); -- rewrite-v +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_daytimetz_key" +ALTER TABLE t ALTER daytimetz TYPE timetz(1); -- rewrite +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_daytimetz_key" +ALTER TABLE t ALTER daytimetz TYPE timetz(2); -- noop +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_daytimetz_key" +ALTER TABLE t ALTER daytimetz TYPE time; -- rewrite +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_daytimetz_key" +ALTER TABLE t ALTER daytime TYPE time(3); -- rewrite-v +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +ALTER TABLE t ALTER daytime TYPE time(1); -- rewrite +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +ALTER TABLE t ALTER daytime TYPE time(2); -- noop +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +ALTER TABLE t ALTER daytime TYPE timetz; -- rewrite +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +ALTER TABLE t ALTER stamptz TYPE timestamptz(3); -- rewrite-v +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +ALTER TABLE t ALTER stamptz TYPE timestamptz(1); -- rewrite +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +ALTER TABLE t ALTER stamptz TYPE timestamptz(2); -- noop +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +ALTER TABLE t ALTER stamptz TYPE timestamp; -- noop +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +SET timezone = 'Asia/Jakarta'; +ALTER TABLE t ALTER stamptz TYPE timestamptz; -- rewrite +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +SET timezone = 'UTC'; +ALTER TABLE t ALTER stamp TYPE timestamp(3); -- rewrite-v +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +ALTER TABLE t ALTER stamp TYPE timestamp(1); -- rewrite +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +ALTER TABLE t ALTER stamp TYPE timestamp(2); -- noop +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +ALTER TABLE t ALTER stamp TYPE timestamptz; -- noop +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +SET timezone = 'Asia/Jakarta'; +ALTER TABLE t ALTER stamp TYPE timestamp; -- rewrite +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +SET timezone = 'UTC'; +ALTER TABLE t ALTER timegap TYPE interval(3); -- rewrite-v +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +ALTER TABLE t ALTER timegap TYPE interval(1); -- rewrite +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +ALTER TABLE t ALTER timegap TYPE interval(2); -- noop +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +ALTER TABLE t ALTER bits TYPE bit(6); -- verify +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_network_key" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +ALTER TABLE t ALTER bits TYPE bit(7); -- verify-e +DEBUG: Rewriting table "t" +ERROR: bit string length 6 does not match type bit(7) +ALTER TABLE t ALTER bits TYPE bit(7) USING bits::bit(7); -- rewrite +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_network_key" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +-- Next one could be a made a noop with an added cast. +ALTER TABLE t ALTER bits TYPE varbit(8); -- verify +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_network_key" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +ALTER TABLE t ALTER bits TYPE varbit(7); -- verify +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_network_key" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +ALTER TABLE t ALTER bits TYPE varbit(5); -- verify-e +DEBUG: Rewriting table "t" +ERROR: bit string too long for type bit varying(5) +ALTER TABLE t ALTER bits TYPE varbit(5) USING bits::varbit(5); -- rewrite +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_network_key" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +ALTER TABLE t ALTER bits TYPE varbit(8); -- noop +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_network_key" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +ALTER TABLE t ALTER network TYPE inet; -- noop +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +ALTER TABLE t ALTER network TYPE cidr; -- rewrite-v +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +ALTER TABLE t ALTER document TYPE text; -- noop +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +ALTER TABLE t ALTER document TYPE xml USING document::xml; -- verify +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +ALTER TABLE t ALTER document TYPE char(20); -- rewrite +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +ALTER TABLE t ALTER document TYPE xml USING document::xml; -- verify +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +ALTER TABLE t ALTER document TYPE varchar(30); -- rewrite-v +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +ALTER TABLE t ALTER document TYPE xml USING document::xml; -- verify +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +ALTER TABLE t ALTER strarr TYPE varchar(4)[]; -- noop +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +DEBUG: Rebuilding index "t_strarr_idx" +ALTER TABLE t ALTER strarr TYPE varchar(3)[]; -- rewrite-v +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +DEBUG: Rebuilding index "t_strarr_idx" +ALTER TABLE t ALTER strarr TYPE varchar(1)[]; -- rewrite-e +DEBUG: Rewriting table "t" +ERROR: value too long for type character varying(1) +ALTER TABLE t ALTER strarr TYPE text[]; -- rewrite +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +DEBUG: Rebuilding index "t_strarr_idx" +ALTER TABLE t ALTER square TYPE polygon; -- rewrite +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +ALTER TABLE t ADD CONSTRAINT u0 UNIQUE (integral); -- build index exactly once +NOTICE: ALTER TABLE / ADD UNIQUE will create implicit index "u0" for table "t" +DEBUG: Rebuilding index "u0" +ALTER TABLE t ADD CONSTRAINT u1 UNIQUE (integral), -- build index exactly once + ALTER integral TYPE int4; -- rewrite +NOTICE: ALTER TABLE / ADD UNIQUE will create implicit index "u1" for table "t" +DEBUG: Rewriting table "t" +DEBUG: Rebuilding index "t_touchy_f_idx" +DEBUG: Rebuilding index "t_expr_idx" +DEBUG: Rebuilding index "t_constraint4_key" +DEBUG: Rebuilding index "t_rational_key" +DEBUG: Rebuilding index "t_string_idx1" +DEBUG: Rebuilding index "t_string_idx" +DEBUG: Rebuilding index "t_daytimetz_key" +DEBUG: Rebuilding index "t_daytime_key" +DEBUG: Rebuilding index "t_stamptz_key" +DEBUG: Rebuilding index "t_stamp_key" +DEBUG: Rebuilding index "t_timegap_key" +DEBUG: Rebuilding index "t_bits_key" +DEBUG: Rebuilding index "t_network_key" +DEBUG: Rebuilding index "t_strarr_idx" +DEBUG: Rebuilding index "t_square_idx" +DEBUG: Rebuilding index "u0" +DEBUG: Rebuilding index "t_integral_key" +DEBUG: Rebuilding index "u1" +-- Data and catalog end state. We omit the columns that bear unstable OIDs. +SELECT * FROM t ORDER BY 1; + constraint0 | constraint1 | constraint2 | constraint3 | constraint4 | integral | rational | string | daytimetz | daytime | stamptz | stamp | timegap | bits | network | document | strarr | square +-------------+-------------+-------------+-------------+-------------+----------+----------+--------+------------+---------------+--------------------------------+----------------------------+------------+-------+-------------+----------------------+---------+--------------------------- + 1 | 2 | 3 | 1.05 | 1.06 | 4 | 10.1200 | fo | 08:44:00.2 | 08:44:00.3+00 | Sat Jan 01 01:44:00.4 2000 UTC | Sat Jan 01 15:44:00.5 2000 | @ 1.6 secs | 01110 | 10.0.0.0/16 | | {ab,cd} | ((0,0),(0,1),(1,1),(1,0)) + 2 | 3 | 4 | 1.15 | 1.16 | 5 | 11.1200 | fo | 09:44:00.2 | 09:44:00.3+00 | Sat Jan 01 02:44:00.4 2000 UTC | Sat Jan 01 16:44:00.5 2000 | @ 2.6 secs | 00110 | 10.1.0.0/16 | | {ef,gh} | ((0,0),(0,2),(2,2),(2,0)) +(2 rows) + +SELECT relname, relnamespace, relowner, relam, reltablespace, relhasindex, + relisshared, relpersistence, relkind, relnatts, relchecks, relhasoids, + relhaspkey, relhasexclusion, relhasrules, relhastriggers, relacl, + reloptions +FROM pg_class WHERE oid = 't'::regclass + OR oid IN (SELECT indexrelid FROM pg_index WHERE indrelid = 't'::regclass) +ORDER BY 1; + relname | relnamespace | relowner | relam | reltablespace | relhasindex | relisshared | relpersistence | relkind | relnatts | relchecks | relhasoids | relhaspkey | relhasexclusion | relhasrules | relhastriggers | relacl | reloptions +-------------------+--------------+----------+-------+---------------+-------------+-------------+----------------+---------+----------+-----------+------------+------------+-----------------+-------------+----------------+--------+------------ + t | 2200 | 10 | 0 | 0 | t | f | p | r | 18 | 1 | f | f | f | f | t | | + t_bits_key | 2200 | 10 | 403 | 0 | f | f | p | i | 1 | 0 | f | f | f | f | f | | + t_constraint4_key | 2200 | 10 | 403 | 0 | f | f | p | i | 1 | 0 | f | f | f | f | f | | + t_daytime_key | 2200 | 10 | 403 | 0 | f | f | p | i | 1 | 0 | f | f | f | f | f | | + t_daytimetz_key | 2200 | 10 | 403 | 0 | f | f | p | i | 1 | 0 | f | f | f | f | f | | + t_expr_idx | 2200 | 10 | 403 | 0 | f | f | p | i | 1 | 0 | f | f | f | f | f | | + t_integral_key | 2200 | 10 | 403 | 0 | f | f | p | i | 1 | 0 | f | f | f | f | f | | + t_network_key | 2200 | 10 | 403 | 0 | f | f | p | i | 1 | 0 | f | f | f | f | f | | + t_rational_key | 2200 | 10 | 403 | 0 | f | f | p | i | 1 | 0 | f | f | f | f | f | | + t_square_idx | 2200 | 10 | 783 | 0 | f | f | p | i | 1 | 0 | f | f | f | f | f | | + t_stamp_key | 2200 | 10 | 403 | 0 | f | f | p | i | 1 | 0 | f | f | f | f | f | | + t_stamptz_key | 2200 | 10 | 403 | 0 | f | f | p | i | 1 | 0 | f | f | f | f | f | | + t_strarr_idx | 2200 | 10 | 2742 | 0 | f | f | p | i | 1 | 0 | f | f | f | f | f | | + t_string_idx | 2200 | 10 | 403 | 0 | f | f | p | i | 1 | 0 | f | f | f | f | f | | + t_string_idx1 | 2200 | 10 | 405 | 0 | f | f | p | i | 1 | 0 | f | f | f | f | f | | + t_timegap_key | 2200 | 10 | 403 | 0 | f | f | p | i | 1 | 0 | f | f | f | f | f | | + t_touchy_f_idx | 2200 | 10 | 403 | 0 | f | f | p | i | 1 | 0 | f | f | f | f | f | | + u0 | 2200 | 10 | 403 | 0 | f | f | p | i | 1 | 0 | f | f | f | f | f | | + u1 | 2200 | 10 | 403 | 0 | f | f | p | i | 1 | 0 | f | f | f | f | f | | +(19 rows) + +SELECT relname, indnatts, indisunique, indisprimary, indimmediate, + indisclustered, indisvalid, indcheckxmin, indisready, indkey, indclass, + indoption +FROM pg_index JOIN pg_class c ON c.oid = indexrelid +WHERE indrelid = 't'::regclass ORDER BY 1; + relname | indnatts | indisunique | indisprimary | indimmediate | indisclustered | indisvalid | indcheckxmin | indisready | indkey | indclass | indoption +-------------------+----------+-------------+--------------+--------------+----------------+------------+--------------+------------+--------+----------+----------- + t_bits_key | 1 | t | f | t | f | t | f | t | 14 | 10051 | 0 + t_constraint4_key | 1 | t | f | t | f | t | f | t | 5 | 10037 | 0 + t_daytime_key | 1 | t | f | t | f | t | f | t | 10 | 10049 | 0 + t_daytimetz_key | 1 | t | f | t | f | t | f | t | 9 | 10045 | 0 + t_expr_idx | 1 | t | f | t | f | t | f | t | 0 | 1978 | 0 + t_integral_key | 1 | t | f | t | f | t | f | t | 6 | 1978 | 0 + t_network_key | 1 | t | f | t | f | t | f | t | 15 | 10025 | 0 + t_rational_key | 1 | t | f | t | f | t | f | t | 7 | 10037 | 0 + t_square_idx | 1 | f | f | t | f | t | f | t | 18 | 10076 | 0 + t_stamp_key | 1 | t | f | t | f | t | f | t | 12 | 10054 | 0 + t_stamptz_key | 1 | t | f | t | f | t | f | t | 11 | 10047 | 0 + t_strarr_idx | 1 | f | f | t | f | t | f | t | 17 | 10079 | 0 + t_string_idx | 1 | f | f | t | f | t | f | t | 8 | 10012 | 0 + t_string_idx1 | 1 | f | f | t | f | t | f | t | 8 | 10013 | 0 + t_timegap_key | 1 | t | f | t | f | t | f | t | 13 | 10031 | 0 + t_touchy_f_idx | 1 | t | f | t | f | t | f | t | 0 | 1978 | 0 + u0 | 1 | t | f | t | f | t | f | t | 6 | 1978 | 0 + u1 | 1 | t | f | t | f | t | f | t | 6 | 1978 | 0 +(18 rows) + +SELECT relname, attname, atttypid, attstattarget, attlen, attnum, attndims, + attcacheoff, atttypmod, attbyval, attstorage, attalign, attnotnull, + atthasdef, attisdropped, attislocal, attinhcount, attacl, attoptions +FROM pg_attribute JOIN pg_class c ON c.oid = attrelid +WHERE attrelid = 't'::regclass OR + attrelid IN (SELECT indexrelid FROM pg_index WHERE indrelid = 't'::regclass) +ORDER BY 1, 2; + relname | attname | atttypid | attstattarget | attlen | attnum | attndims | attcacheoff | atttypmod | attbyval | attstorage | attalign | attnotnull | atthasdef | attisdropped | attislocal | attinhcount | attacl | attoptions +-------------------+-------------+----------+---------------+--------+--------+----------+-------------+------------+----------+------------+----------+------------+-----------+--------------+------------+-------------+--------+------------ + t | bits | 1562 | -1 | -1 | 14 | 0 | -1 | 8 | f | x | i | t | f | f | t | 0 | | + t | cmax | 29 | 0 | 4 | -6 | 0 | -1 | -1 | t | p | i | t | f | f | t | 0 | | + t | cmin | 29 | 0 | 4 | -4 | 0 | -1 | -1 | t | p | i | t | f | f | t | 0 | | + t | constraint0 | 23 | -1 | 4 | 1 | 0 | -1 | -1 | t | p | i | t | f | f | t | 0 | | + t | constraint1 | 23 | -1 | 4 | 2 | 0 | -1 | -1 | t | p | i | t | f | f | t | 0 | | + t | constraint2 | 23 | -1 | 4 | 3 | 0 | -1 | -1 | t | p | i | t | f | f | t | 0 | | + t | constraint3 | 1700 | -1 | -1 | 4 | 0 | -1 | 589830 | f | m | i | t | f | f | t | 0 | | + t | constraint4 | 1700 | -1 | -1 | 5 | 0 | -1 | 589830 | f | m | i | t | f | f | t | 0 | | + t | ctid | 27 | 0 | 6 | -1 | 0 | -1 | -1 | f | p | s | t | f | f | t | 0 | | + t | daytime | 1266 | -1 | 12 | 10 | 0 | -1 | -1 | f | p | d | t | f | f | t | 0 | | + t | daytimetz | 1083 | -1 | 8 | 9 | 0 | -1 | -1 | t | p | d | t | f | f | t | 0 | | + t | document | 142 | -1 | -1 | 16 | 0 | -1 | -1 | f | x | i | t | f | f | t | 0 | | + t | integral | 23 | -1 | 4 | 6 | 0 | -1 | -1 | t | p | i | t | f | f | t | 0 | | + t | network | 650 | -1 | -1 | 15 | 0 | -1 | -1 | f | m | i | t | f | f | t | 0 | | + t | rational | 1700 | -1 | -1 | 7 | 0 | -1 | -1 | f | m | i | t | f | f | t | 0 | | + t | square | 604 | -1 | -1 | 18 | 0 | -1 | -1 | f | x | d | t | f | f | t | 0 | | + t | stamp | 1114 | -1 | 8 | 12 | 0 | -1 | -1 | t | p | d | t | f | f | t | 0 | | + t | stamptz | 1184 | -1 | 8 | 11 | 0 | -1 | -1 | t | p | d | t | f | f | t | 0 | | + t | strarr | 1009 | -1 | -1 | 17 | 1 | -1 | -1 | f | x | i | t | f | f | t | 0 | | + t | string | 1042 | -1 | -1 | 8 | 0 | -1 | 8 | f | x | i | t | f | f | t | 0 | | + t | tableoid | 26 | 0 | 4 | -7 | 0 | -1 | -1 | t | p | i | t | f | f | t | 0 | | + t | timegap | 1186 | -1 | 16 | 13 | 0 | -1 | 2147418114 | f | p | d | t | f | f | t | 0 | | + t | xmax | 28 | 0 | 4 | -5 | 0 | -1 | -1 | t | p | i | t | f | f | t | 0 | | + t | xmin | 28 | 0 | 4 | -3 | 0 | -1 | -1 | t | p | i | t | f | f | t | 0 | | + t_bits_key | bits | 1562 | -1 | -1 | 1 | 0 | -1 | 8 | f | x | i | f | f | f | t | 0 | | + t_constraint4_key | constraint4 | 1700 | -1 | -1 | 1 | 0 | -1 | 589830 | f | m | i | f | f | f | t | 0 | | + t_daytime_key | daytime | 1266 | -1 | 12 | 1 | 0 | -1 | -1 | f | p | d | f | f | f | t | 0 | | + t_daytimetz_key | daytimetz | 1083 | -1 | 8 | 1 | 0 | -1 | -1 | t | p | d | f | f | f | t | 0 | | + t_expr_idx | expr | 23 | -1 | 4 | 1 | 0 | -1 | -1 | t | p | i | f | f | f | t | 0 | | + t_integral_key | integral | 23 | -1 | 4 | 1 | 0 | -1 | -1 | t | p | i | f | f | f | t | 0 | | + t_network_key | network | 650 | -1 | -1 | 1 | 0 | -1 | -1 | f | m | i | f | f | f | t | 0 | | + t_rational_key | rational | 1700 | -1 | -1 | 1 | 0 | -1 | -1 | f | m | i | f | f | f | t | 0 | | + t_square_idx | square | 603 | -1 | 32 | 1 | 0 | -1 | -1 | f | p | d | f | f | f | t | 0 | | + t_stamp_key | stamp | 1114 | -1 | 8 | 1 | 0 | -1 | -1 | t | p | d | f | f | f | t | 0 | | + t_stamptz_key | stamptz | 1184 | -1 | 8 | 1 | 0 | -1 | -1 | t | p | d | f | f | f | t | 0 | | + t_strarr_idx | strarr | 25 | -1 | -1 | 1 | 1 | -1 | -1 | f | x | i | f | f | f | t | 0 | | + t_string_idx | string | 1042 | -1 | -1 | 1 | 0 | -1 | 8 | f | x | i | f | f | f | t | 0 | | + t_string_idx1 | string | 23 | -1 | 4 | 1 | 0 | -1 | -1 | t | p | i | f | f | f | t | 0 | | + t_timegap_key | timegap | 1186 | -1 | 16 | 1 | 0 | -1 | 2147418114 | f | p | d | f | f | f | t | 0 | | + t_touchy_f_idx | touchy_f | 23 | -1 | 4 | 1 | 0 | -1 | -1 | t | p | i | f | f | f | t | 0 | | + u0 | integral | 23 | -1 | 4 | 1 | 0 | -1 | -1 | t | p | i | f | f | f | t | 0 | | + u1 | integral | 23 | -1 | 4 | 1 | 0 | -1 | -1 | t | p | i | f | f | f | t | 0 | | +(42 rows) + +SELECT conname, connamespace, contype, condeferrable, condeferred, confupdtype, + confdeltype, confmatchtype, conislocal, coninhcount, conkey, confkey, + conpfeqop, conppeqop, conffeqop, conexclop, consrc +FROM pg_constraint WHERE conrelid = 't'::regclass +ORDER BY 1; + conname | connamespace | contype | condeferrable | condeferred | confupdtype | confdeltype | confmatchtype | conislocal | coninhcount | conkey | confkey | conpfeqop | conppeqop | conffeqop | conexclop | consrc +---------------------+--------------+---------+---------------+-------------+-------------+-------------+---------------+------------+-------------+--------+---------+-----------+-----------+-----------+-----------+------------------------------ + t_bits_key | 2200 | u | f | f | | | | t | 0 | {14} | | | | | | + t_constraint0_check | 2200 | c | f | f | | | | t | 0 | {1} | | | | | | (touchy_f(constraint0) < 10) + t_constraint3_fkey | 2200 | f | f | f | a | a | u | t | 0 | {4} | {1} | {1752} | {1752} | {1752} | | + t_constraint4_key | 2200 | u | f | f | | | | t | 0 | {5} | | | | | | + t_daytime_key | 2200 | u | f | f | | | | t | 0 | {10} | | | | | | + t_daytimetz_key | 2200 | u | f | f | | | | t | 0 | {9} | | | | | | + t_integral_key | 2200 | u | f | f | | | | t | 0 | {6} | | | | | | + t_network_key | 2200 | u | f | f | | | | t | 0 | {15} | | | | | | + t_rational_key | 2200 | u | f | f | | | | t | 0 | {7} | | | | | | + t_stamp_key | 2200 | u | f | f | | | | t | 0 | {12} | | | | | | + t_stamptz_key | 2200 | u | f | f | | | | t | 0 | {11} | | | | | | + t_timegap_key | 2200 | u | f | f | | | | t | 0 | {13} | | | | | | + u0 | 2200 | u | f | f | | | | t | 0 | {6} | | | | | | + u1 | 2200 | u | f | f | | | | t | 0 | {6} | | | | | | +(14 rows) + +-- RI trigger names include the table OID. We don't have a great sort order +-- available, but tgname probably serves acceptably in practice. +SELECT tgfoid, tgtype, tgenabled, tgisinternal, tgdeferrable, tginitdeferred, + tgnargs, tgattr, tgargs, tgqual +FROM pg_trigger WHERE tgrelid = 't'::regclass ORDER BY tgname; + tgfoid | tgtype | tgenabled | tgisinternal | tgdeferrable | tginitdeferred | tgnargs | tgattr | tgargs | tgqual +--------+--------+-----------+--------------+--------------+----------------+---------+--------+--------+-------- + 1644 | 5 | O | t | f | f | 0 | | \x | + 1645 | 17 | O | t | f | f | 0 | | \x | + 1654 | 9 | O | t | f | f | 0 | | \x | + 1655 | 17 | O | t | f | f | 0 | | \x | +(4 rows) + +-- Done. Retain the table under a less-generic name. +ALTER TABLE t RENAME TO alter_type_test; +RESET client_min_messages; +RESET timezone; -- -- lock levels -- diff --git a/src/test/regress/sql/alter_table.sql b/src/test/regress/sql/alter_table.sql index 4895768..18d60e1 100644 --- a/src/test/regress/sql/alter_table.sql +++ b/src/test/regress/sql/alter_table.sql @@ -1094,6 +1094,308 @@ drop table another; create table tab1 (a int, b text); create table tab2 (x int, y tab1); alter table tab1 alter column b type varchar; -- fails +alter table tab1 add check (b <> 'foo'); +alter table tab1 add c int not null; +alter table tab1 add d int not null default 1; -- fails +alter table tab1 drop a; +alter table tab1 set with oids; -- fails + +-- +-- Deeper alter-column-type tests +-- +SET client_min_messages = debug1; -- Track rewrites. +SET timezone = UTC; + +-- Model a type change that throws the semantics of dependent expressions. +CREATE DOMAIN trickint AS int; +CREATE FUNCTION touchy_f(trickint) RETURNS int4 LANGUAGE sql AS 'SELECT 100'; +CREATE FUNCTION touchy_f(int4) RETURNS int4 LANGUAGE sql AS 'SELECT $1'; + +CREATE DOMAIN loosedom AS text; +CREATE DOMAIN lendom AS varchar(10); +CREATE DOMAIN shortdom AS varchar(1); +CREATE DOMAIN checkdom AS text CHECK (VALUE LIKE 'A_'); +CREATE DOMAIN faildom AS text CHECK (VALUE LIKE 'B_'); + +CREATE TABLE parent (keycol numeric PRIMARY KEY); +INSERT INTO parent VALUES (1.1), (1.05), (1.15); + +CREATE TABLE t ( + constraint0 int4 NOT NULL, + constraint1 int4 NOT NULL, + constraint2 int4 NOT NULL, + constraint3 numeric NOT NULL REFERENCES parent, + constraint4 numeric UNIQUE NOT NULL, + + integral int4 UNIQUE NOT NULL, + rational numeric UNIQUE NOT NULL, + string varchar(2) NOT NULL, + daytimetz timetz UNIQUE NOT NULL, + daytime time UNIQUE NOT NULL, + stamptz timestamptz UNIQUE NOT NULL, + stamp timestamp UNIQUE NOT NULL, + timegap interval UNIQUE NOT NULL, + bits bit varying UNIQUE NOT NULL, + network cidr UNIQUE NOT NULL, + document xml NOT NULL, + strarr varchar(2)[] NOT NULL, + square box NOT NULL, + + CHECK (touchy_f(constraint0) < 10) +); +CREATE INDEX ON t (string); +CREATE INDEX ON t USING hash (string); +CREATE INDEX ON t USING gin (strarr); +CREATE INDEX ON t USING gist (square); +CREATE UNIQUE INDEX ON t ((touchy_f(constraint1))); +CREATE UNIQUE INDEX ON t ((1)) WHERE touchy_f(constraint2) = 100; +INSERT INTO t VALUES +( + 1, + 2, + 3, + 1.05, + 1.06, + + 4, + 10.12, + 'AB', + '8:44:00.19', + '8:44:00.29', + '2000-01-01 08:44:00.39', + '2000-01-01 08:44:00.49', + '00:00:01.59', + '011101', + '10.0.0.0/16', + '', + '{ab,cd}', + '(1,1),(0,0)' +), +( + 2, + 3, + 4, + 1.15, + 1.16, + + 5, + 11.12, + 'AC', + '9:44:00.19', + '9:44:00.29', + '2000-01-01 09:44:00.39', + '2000-01-01 09:44:00.49', + '00:00:02.59', + '001101', + '10.1.0.0/16', + '', + '{ef,gh}', + '(2,2),(0,0)' +); + +CREATE TABLE child (keycol numeric PRIMARY KEY REFERENCES t(constraint4)); +INSERT INTO child VALUES (1.06), (1.16); + + +-- Data and catalog begin state. Keep this synchronized with the copy below. +SELECT * FROM t ORDER BY 1; + +SELECT relname, relnamespace, relowner, relam, reltablespace, relhasindex, + relisshared, relpersistence, relkind, relnatts, relchecks, relhasoids, + relhaspkey, relhasexclusion, relhasrules, relhastriggers, relacl, + reloptions +FROM pg_class WHERE oid = 't'::regclass + OR oid IN (SELECT indexrelid FROM pg_index WHERE indrelid = 't'::regclass) +ORDER BY 1; + +SELECT relname, indnatts, indisunique, indisprimary, indimmediate, + indisclustered, indisvalid, indcheckxmin, indisready, indkey, indclass, + indoption +FROM pg_index JOIN pg_class c ON c.oid = indexrelid +WHERE indrelid = 't'::regclass ORDER BY 1; + +SELECT relname, attname, atttypid, attstattarget, attlen, attnum, attndims, + attcacheoff, atttypmod, attbyval, attstorage, attalign, attnotnull, + atthasdef, attisdropped, attislocal, attinhcount, attacl, attoptions +FROM pg_attribute JOIN pg_class c ON c.oid = attrelid +WHERE attrelid = 't'::regclass OR + attrelid IN (SELECT indexrelid FROM pg_index WHERE indrelid = 't'::regclass) +ORDER BY 1, 2; + +SELECT conname, connamespace, contype, condeferrable, condeferred, confupdtype, + confdeltype, confmatchtype, conislocal, coninhcount, conkey, confkey, + conpfeqop, conppeqop, conffeqop, conexclop, consrc +FROM pg_constraint WHERE conrelid = 't'::regclass +ORDER BY 1; + +-- RI trigger names include the table OID. We don't have a great sort order +-- available, but tgname probably serves acceptably in practice. +SELECT tgfoid, tgtype, tgenabled, tgisinternal, tgdeferrable, tginitdeferred, + tgnargs, tgattr, tgargs, tgqual +FROM pg_trigger WHERE tgrelid = 't'::regclass ORDER BY tgname; + + +-- Comments "rewrite", "verify" and "noop" signify whether ATRewriteTables +-- rewrites, scans or does nothing to the table proper. An "-e" suffix denotes +-- an error outcome. A "-v" suffix means that the rewrite does not actually +-- change data, but we did it anyway out of an inability to prove that in +-- advance. Decisions to rebuild indexes or recheck foreign keys are notable, +-- though mostly not stated here. + +-- Constraint failures induced by a no-work type change. +ALTER TABLE t ALTER constraint0 TYPE trickint; -- verify-e +ALTER TABLE t ALTER constraint1 TYPE trickint; -- noop-e +ALTER TABLE t ALTER constraint2 TYPE trickint; -- noop-e +-- Temporary fixup until behavior of the previous two improves. +ALTER TABLE t ALTER constraint1 TYPE int, ALTER constraint2 TYPE int; + +-- Change a column with an outgoing foreign key constraint. +ALTER TABLE t ALTER constraint3 TYPE numeric(8,1); -- rewrite, FK error +ALTER TABLE t ALTER constraint3 TYPE numeric(8,2); -- rewrite, FK verify +ALTER TABLE t ALTER constraint3 TYPE numeric(7,2); -- verify; FK noop +ALTER TABLE t ALTER constraint3 TYPE numeric(9,2); -- noop; FK noop + +-- Change a column with an incoming foreign key constraint. +ALTER TABLE t ALTER constraint4 TYPE numeric(8,1); -- rewrite; FK error +ALTER TABLE t ALTER constraint4 TYPE numeric(8,2); -- rewrite; FK verify +ALTER TABLE t ALTER constraint4 TYPE numeric(7,2); -- verify; FK noop +ALTER TABLE t ALTER constraint4 TYPE numeric(9,2); -- noop; FK noop + +-- Type-specific tests. +ALTER TABLE t ALTER integral TYPE abstime USING integral::abstime; -- noop +ALTER TABLE t ALTER integral TYPE oid USING integral::int4; -- noop +ALTER TABLE t ALTER integral TYPE regtype; -- noop +ALTER TABLE t ALTER integral TYPE int8; -- rewrite +ALTER TABLE t ALTER integral TYPE int2; -- rewrite + +ALTER TABLE t ALTER rational TYPE numeric(10,2); -- rewrite-v +ALTER TABLE t ALTER rational TYPE numeric(12,4); -- rewrite +ALTER TABLE t ALTER rational TYPE numeric(13,4); -- noop +ALTER TABLE t ALTER rational TYPE numeric(11,4); -- verify +ALTER TABLE t ALTER rational TYPE numeric; -- noop +ALTER TABLE t ALTER rational TYPE numeric(5,4); -- verify-e +ALTER TABLE t ALTER rational TYPE numeric(4,3); -- rewrite-e + +ALTER TABLE t ALTER string TYPE varchar(4); -- noop +ALTER TABLE t ALTER string TYPE lendom; -- noop +ALTER TABLE t ALTER string TYPE shortdom; -- rewrite-e +ALTER TABLE t ALTER string TYPE checkdom; -- verify +ALTER TABLE t ALTER string TYPE faildom; -- verify-e +ALTER TABLE t ALTER string TYPE loosedom; -- noop +ALTER TABLE t ALTER string TYPE text; -- noop +ALTER TABLE t ALTER string TYPE varchar(20); -- rewrite-v +ALTER TABLE t ALTER string TYPE varchar(1); -- rewrite-e +ALTER TABLE t ALTER string TYPE varchar(1) USING t::varchar(1); -- rewrite +ALTER TABLE t ALTER string TYPE text USING 'foo'::varchar; -- rewrite +ALTER TABLE t ALTER string TYPE char(3); -- rewrite-v +ALTER TABLE t ALTER string TYPE char(2); -- rewrite-e +ALTER TABLE t ALTER string TYPE char(2) USING string::char(2); -- rewrite +ALTER TABLE t ALTER string TYPE char(4); -- rewrite + +ALTER TABLE t ALTER daytimetz TYPE timetz(3); -- rewrite-v +ALTER TABLE t ALTER daytimetz TYPE timetz(1); -- rewrite +ALTER TABLE t ALTER daytimetz TYPE timetz(2); -- noop +ALTER TABLE t ALTER daytimetz TYPE time; -- rewrite + +ALTER TABLE t ALTER daytime TYPE time(3); -- rewrite-v +ALTER TABLE t ALTER daytime TYPE time(1); -- rewrite +ALTER TABLE t ALTER daytime TYPE time(2); -- noop +ALTER TABLE t ALTER daytime TYPE timetz; -- rewrite + +ALTER TABLE t ALTER stamptz TYPE timestamptz(3); -- rewrite-v +ALTER TABLE t ALTER stamptz TYPE timestamptz(1); -- rewrite +ALTER TABLE t ALTER stamptz TYPE timestamptz(2); -- noop +ALTER TABLE t ALTER stamptz TYPE timestamp; -- noop +SET timezone = 'Asia/Jakarta'; +ALTER TABLE t ALTER stamptz TYPE timestamptz; -- rewrite +SET timezone = 'UTC'; + +ALTER TABLE t ALTER stamp TYPE timestamp(3); -- rewrite-v +ALTER TABLE t ALTER stamp TYPE timestamp(1); -- rewrite +ALTER TABLE t ALTER stamp TYPE timestamp(2); -- noop +ALTER TABLE t ALTER stamp TYPE timestamptz; -- noop +SET timezone = 'Asia/Jakarta'; +ALTER TABLE t ALTER stamp TYPE timestamp; -- rewrite +SET timezone = 'UTC'; + +ALTER TABLE t ALTER timegap TYPE interval(3); -- rewrite-v +ALTER TABLE t ALTER timegap TYPE interval(1); -- rewrite +ALTER TABLE t ALTER timegap TYPE interval(2); -- noop + +ALTER TABLE t ALTER bits TYPE bit(6); -- verify +ALTER TABLE t ALTER bits TYPE bit(7); -- verify-e +ALTER TABLE t ALTER bits TYPE bit(7) USING bits::bit(7); -- rewrite +-- Next one could be a made a noop with an added cast. +ALTER TABLE t ALTER bits TYPE varbit(8); -- verify +ALTER TABLE t ALTER bits TYPE varbit(7); -- verify +ALTER TABLE t ALTER bits TYPE varbit(5); -- verify-e +ALTER TABLE t ALTER bits TYPE varbit(5) USING bits::varbit(5); -- rewrite +ALTER TABLE t ALTER bits TYPE varbit(8); -- noop + +ALTER TABLE t ALTER network TYPE inet; -- noop +ALTER TABLE t ALTER network TYPE cidr; -- rewrite-v + +ALTER TABLE t ALTER document TYPE text; -- noop +ALTER TABLE t ALTER document TYPE xml USING document::xml; -- verify +ALTER TABLE t ALTER document TYPE char(20); -- rewrite +ALTER TABLE t ALTER document TYPE xml USING document::xml; -- verify +ALTER TABLE t ALTER document TYPE varchar(30); -- rewrite-v +ALTER TABLE t ALTER document TYPE xml USING document::xml; -- verify + +ALTER TABLE t ALTER strarr TYPE varchar(4)[]; -- noop +ALTER TABLE t ALTER strarr TYPE varchar(3)[]; -- rewrite-v +ALTER TABLE t ALTER strarr TYPE varchar(1)[]; -- rewrite-e +ALTER TABLE t ALTER strarr TYPE text[]; -- rewrite + +ALTER TABLE t ALTER square TYPE polygon; -- rewrite + +ALTER TABLE t ADD CONSTRAINT u0 UNIQUE (integral); -- build index exactly once +ALTER TABLE t ADD CONSTRAINT u1 UNIQUE (integral), -- build index exactly once + ALTER integral TYPE int4; -- rewrite + + +-- Data and catalog end state. We omit the columns that bear unstable OIDs. +SELECT * FROM t ORDER BY 1; + +SELECT relname, relnamespace, relowner, relam, reltablespace, relhasindex, + relisshared, relpersistence, relkind, relnatts, relchecks, relhasoids, + relhaspkey, relhasexclusion, relhasrules, relhastriggers, relacl, + reloptions +FROM pg_class WHERE oid = 't'::regclass + OR oid IN (SELECT indexrelid FROM pg_index WHERE indrelid = 't'::regclass) +ORDER BY 1; + +SELECT relname, indnatts, indisunique, indisprimary, indimmediate, + indisclustered, indisvalid, indcheckxmin, indisready, indkey, indclass, + indoption +FROM pg_index JOIN pg_class c ON c.oid = indexrelid +WHERE indrelid = 't'::regclass ORDER BY 1; + +SELECT relname, attname, atttypid, attstattarget, attlen, attnum, attndims, + attcacheoff, atttypmod, attbyval, attstorage, attalign, attnotnull, + atthasdef, attisdropped, attislocal, attinhcount, attacl, attoptions +FROM pg_attribute JOIN pg_class c ON c.oid = attrelid +WHERE attrelid = 't'::regclass OR + attrelid IN (SELECT indexrelid FROM pg_index WHERE indrelid = 't'::regclass) +ORDER BY 1, 2; + +SELECT conname, connamespace, contype, condeferrable, condeferred, confupdtype, + confdeltype, confmatchtype, conislocal, coninhcount, conkey, confkey, + conpfeqop, conppeqop, conffeqop, conexclop, consrc +FROM pg_constraint WHERE conrelid = 't'::regclass +ORDER BY 1; + +-- RI trigger names include the table OID. We don't have a great sort order +-- available, but tgname probably serves acceptably in practice. +SELECT tgfoid, tgtype, tgenabled, tgisinternal, tgdeferrable, tginitdeferred, + tgnargs, tgattr, tgargs, tgqual +FROM pg_trigger WHERE tgrelid = 't'::regclass ORDER BY tgname; + + +-- Done. Retain the table under a less-generic name. +ALTER TABLE t RENAME TO alter_type_test; +RESET client_min_messages; +RESET timezone; -- -- lock levels