On Thu, Aug 28, 2014 at 10:51 PM, Michael Paquier <michael.paqu...@gmail.com> wrote: > Because of how reloptions is registered in pg_class: The patch attached fixes pg_upgrade by putting quotes when generating reloptions and it passes check-world. I imagine that having quotes by default in the value of reloptions in pg_class is the price to pay for supporting units. If this is not considered as a correct approach, then reverting the patch would be wiser I guess. Regards, -- Michael
*** a/contrib/test_decoding/expected/ddl.out --- b/contrib/test_decoding/expected/ddl.out *************** *** 345,351 **** WITH (user_catalog_table = true) options | text[] | | extended | | Indexes: "replication_metadata_pkey" PRIMARY KEY, btree (id) ! Options: user_catalog_table=true INSERT INTO replication_metadata(relation, options) VALUES ('foo', ARRAY['a', 'b']); --- 345,351 ---- options | text[] | | extended | | Indexes: "replication_metadata_pkey" PRIMARY KEY, btree (id) ! Options: user_catalog_table='true' INSERT INTO replication_metadata(relation, options) VALUES ('foo', ARRAY['a', 'b']); *************** *** 372,378 **** ALTER TABLE replication_metadata SET (user_catalog_table = true); options | text[] | | extended | | Indexes: "replication_metadata_pkey" PRIMARY KEY, btree (id) ! Options: user_catalog_table=true INSERT INTO replication_metadata(relation, options) VALUES ('blub', NULL); --- 372,378 ---- options | text[] | | extended | | Indexes: "replication_metadata_pkey" PRIMARY KEY, btree (id) ! Options: user_catalog_table='true' INSERT INTO replication_metadata(relation, options) VALUES ('blub', NULL); *************** *** 391,397 **** ALTER TABLE replication_metadata SET (user_catalog_table = false); rewritemeornot | integer | | plain | | Indexes: "replication_metadata_pkey" PRIMARY KEY, btree (id) ! Options: user_catalog_table=false INSERT INTO replication_metadata(relation, options) VALUES ('zaphod', NULL); --- 391,397 ---- rewritemeornot | integer | | plain | | Indexes: "replication_metadata_pkey" PRIMARY KEY, btree (id) ! Options: user_catalog_table='false' INSERT INTO replication_metadata(relation, options) VALUES ('zaphod', NULL); *** a/src/backend/access/common/reloptions.c --- b/src/backend/access/common/reloptions.c *************** *** 728,734 **** transformRelOptions(Datum oldOptions, List *defList, char *namspace, continue; /* ! * Flatten the DefElem into a text string like "name=arg". If we * have just "name", assume "name=true" is meant. Note: the * namespace is not output. */ --- 728,734 ---- continue; /* ! * Flatten the DefElem into a text string like "name='arg'". If we * have just "name", assume "name=true" is meant. Note: the * namespace is not output. */ *************** *** 736,746 **** transformRelOptions(Datum oldOptions, List *defList, char *namspace, value = defGetString(def); else value = "true"; ! len = VARHDRSZ + strlen(def->defname) + 1 + strlen(value); /* +1 leaves room for sprintf's trailing null */ t = (text *) palloc(len + 1); SET_VARSIZE(t, len); ! sprintf(VARDATA(t), "%s=%s", def->defname, value); astate = accumArrayResult(astate, PointerGetDatum(t), false, TEXTOID, --- 736,746 ---- value = defGetString(def); else value = "true"; ! len = VARHDRSZ + strlen(def->defname) + 3 + strlen(value); /* +1 leaves room for sprintf's trailing null */ t = (text *) palloc(len + 1); SET_VARSIZE(t, len); ! sprintf(VARDATA(t), "%s='%s'", def->defname, value); astate = accumArrayResult(astate, PointerGetDatum(t), false, TEXTOID, *************** *** 982,990 **** parse_one_reloption(relopt_value *option, char *text_str, int text_len, errmsg("parameter \"%s\" specified more than once", option->gen->name))); ! value_len = text_len - option->gen->namelen - 1; value = (char *) palloc(value_len + 1); ! memcpy(value, text_str + option->gen->namelen + 1, value_len); value[value_len] = '\0'; switch (option->gen->type) --- 982,990 ---- errmsg("parameter \"%s\" specified more than once", option->gen->name))); ! value_len = text_len - option->gen->namelen - 3; value = (char *) palloc(value_len + 1); ! memcpy(value, text_str + option->gen->namelen + 2, value_len); value[value_len] = '\0'; switch (option->gen->type) *** a/src/backend/catalog/information_schema.sql --- b/src/backend/catalog/information_schema.sql *************** *** 2502,2510 **** CREATE VIEW views AS AS character_data) AS view_definition, CAST( ! CASE WHEN 'check_option=cascaded' = ANY (c.reloptions) THEN 'CASCADED' ! WHEN 'check_option=local' = ANY (c.reloptions) THEN 'LOCAL' ELSE 'NONE' END AS character_data) AS check_option, --- 2502,2510 ---- AS character_data) AS view_definition, CAST( ! CASE WHEN 'check_option=''cascaded''' = ANY (c.reloptions) THEN 'CASCADED' ! WHEN 'check_option=''local''' = ANY (c.reloptions) THEN 'LOCAL' ELSE 'NONE' END AS character_data) AS check_option, *** a/src/test/regress/expected/alter_table.out --- b/src/test/regress/expected/alter_table.out *************** *** 1823,1829 **** ERROR: invalid value for integer option "autovacuum_analyze_threshold": 3min Column | Type | Modifiers | Storage | Stats target | Description --------+------+-----------+----------+--------------+------------- a | text | | extended | | ! Options: autovacuum_vacuum_cost_delay=80ms -- -- lock levels --- 1823,1829 ---- Column | Type | Modifiers | Storage | Stats target | Description --------+------+-----------+----------+--------------+------------- a | text | | extended | | ! Options: autovacuum_vacuum_cost_delay='80ms' -- -- lock levels *** a/src/test/regress/expected/create_view.out --- b/src/test/regress/expected/create_view.out *************** *** 260,271 **** SELECT relname, relkind, reloptions FROM pg_class WHERE oid in ('mysecview1'::regclass, 'mysecview2'::regclass, 'mysecview3'::regclass, 'mysecview4'::regclass) ORDER BY relname; ! relname | relkind | reloptions ! ------------+---------+-------------------------- mysecview1 | v | ! mysecview2 | v | {security_barrier=true} ! mysecview3 | v | {security_barrier=false} ! mysecview4 | v | {security_barrier=true} (4 rows) CREATE OR REPLACE VIEW mysecview1 --- 260,271 ---- WHERE oid in ('mysecview1'::regclass, 'mysecview2'::regclass, 'mysecview3'::regclass, 'mysecview4'::regclass) ORDER BY relname; ! relname | relkind | reloptions ! ------------+---------+---------------------------- mysecview1 | v | ! mysecview2 | v | {security_barrier='true'} ! mysecview3 | v | {security_barrier='false'} ! mysecview4 | v | {security_barrier='true'} (4 rows) CREATE OR REPLACE VIEW mysecview1 *************** *** 280,291 **** SELECT relname, relkind, reloptions FROM pg_class WHERE oid in ('mysecview1'::regclass, 'mysecview2'::regclass, 'mysecview3'::regclass, 'mysecview4'::regclass) ORDER BY relname; ! relname | relkind | reloptions ! ------------+---------+-------------------------- mysecview1 | v | mysecview2 | v | ! mysecview3 | v | {security_barrier=true} ! mysecview4 | v | {security_barrier=false} (4 rows) -- Test view decompilation in the face of relation renaming conflicts --- 280,291 ---- WHERE oid in ('mysecview1'::regclass, 'mysecview2'::regclass, 'mysecview3'::regclass, 'mysecview4'::regclass) ORDER BY relname; ! relname | relkind | reloptions ! ------------+---------+---------------------------- mysecview1 | v | mysecview2 | v | ! mysecview3 | v | {security_barrier='true'} ! mysecview4 | v | {security_barrier='false'} (4 rows) -- Test view decompilation in the face of relation renaming conflicts *** a/src/test/regress/expected/updatable_views.out --- b/src/test/regress/expected/updatable_views.out *************** *** 1382,1388 **** View definition: base_tbl.b FROM base_tbl WHERE base_tbl.a < base_tbl.b; ! Options: check_option=local SELECT * FROM information_schema.views WHERE table_name = 'rw_view1'; table_catalog | table_schema | table_name | view_definition | check_option | is_updatable | is_insertable_into | is_trigger_updatable | is_trigger_deletable | is_trigger_insertable_into --- 1382,1388 ---- base_tbl.b FROM base_tbl WHERE base_tbl.a < base_tbl.b; ! Options: check_option='local' SELECT * FROM information_schema.views WHERE table_name = 'rw_view1'; table_catalog | table_schema | table_name | view_definition | check_option | is_updatable | is_insertable_into | is_trigger_updatable | is_trigger_deletable | is_trigger_insertable_into *************** *** 1434,1440 **** View definition: SELECT rw_view1.a FROM rw_view1 WHERE rw_view1.a < 10; ! Options: check_option=cascaded SELECT * FROM information_schema.views WHERE table_name = 'rw_view2'; table_catalog | table_schema | table_name | view_definition | check_option | is_updatable | is_insertable_into | is_trigger_updatable | is_trigger_deletable | is_trigger_insertable_into --- 1434,1440 ---- SELECT rw_view1.a FROM rw_view1 WHERE rw_view1.a < 10; ! Options: check_option='cascaded' SELECT * FROM information_schema.views WHERE table_name = 'rw_view2'; table_catalog | table_schema | table_name | view_definition | check_option | is_updatable | is_insertable_into | is_trigger_updatable | is_trigger_deletable | is_trigger_insertable_into *************** *** 1474,1480 **** View definition: SELECT rw_view1.a FROM rw_view1 WHERE rw_view1.a < 10; ! Options: check_option=local SELECT * FROM information_schema.views WHERE table_name = 'rw_view2'; table_catalog | table_schema | table_name | view_definition | check_option | is_updatable | is_insertable_into | is_trigger_updatable | is_trigger_deletable | is_trigger_insertable_into --- 1474,1480 ---- SELECT rw_view1.a FROM rw_view1 WHERE rw_view1.a < 10; ! Options: check_option='local' SELECT * FROM information_schema.views WHERE table_name = 'rw_view2'; table_catalog | table_schema | table_name | view_definition | check_option | is_updatable | is_insertable_into | is_trigger_updatable | is_trigger_deletable | is_trigger_insertable_into *** a/src/test/regress/output/tablespace.source --- b/src/test/regress/output/tablespace.source *************** *** 4,12 **** ERROR: unrecognized parameter "some_nonexistent_parameter" CREATE TABLESPACE testspacewith LOCATION '@testtablespace@' WITH (random_page_cost = 3.0); -- ok -- check to see the parameter was used SELECT spcoptions FROM pg_tablespace WHERE spcname = 'testspacewith'; ! spcoptions ! ------------------------ ! {random_page_cost=3.0} (1 row) -- drop the tablespace so we can re-use the location --- 4,12 ---- CREATE TABLESPACE testspacewith LOCATION '@testtablespace@' WITH (random_page_cost = 3.0); -- ok -- check to see the parameter was used SELECT spcoptions FROM pg_tablespace WHERE spcname = 'testspacewith'; ! spcoptions ! -------------------------- ! {random_page_cost='3.0'} (1 row) -- drop the tablespace so we can re-use the location
-- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers