Re: ALTER command reworks

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Kohei KaiGai <kaigai(at)kaigai(dot)gr(dot)jp>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: ALTER command reworks
Date: 2012-09-27 20:38:04
Message-ID: 1348777893-sup-5680@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Excerpts from Kohei KaiGai's message of lun sep 10 08:08:32 -0300 2012:

> As attached, I split off the original one into three portions; for set-schema,
> set-owner and rename-to. Please apply them in order of patch filename.
> Regarding to the error message, RenameErrorMsgAlreadyExists() was added
> to handle per object type messages in case when aclcheck_error() is not
> available to utilize.
> All the regression test is contained with the 1st patch to make sure the
> series of reworks does not change existing behaviors.

I checked this and noticed that the regression test has a couple of
failures -- see below. I think we should remove the test for the first
two hunks, and fix the query for the final one to remove the offending
column.

The good news is that I ran this without applying the whole patch, only
the new regression test' files. I didn't check the files in detail.

I have skimmed over the patches and they seem reasonable too; I will
look at them in more detail later. I think we should go ahead and apply
the (tweaked) regression test alone, as a first step.

*** /pgsql/source/HEAD/src/test/regress/expected/alter_generic.out 2012-09-27 17:23:05.000000000 -0300
--- /home/alvherre/Code/pgsql/build/HEAD/src/test/regress/results/alter_generic.out 2012-09-27 17:29:21.000000000 -0300
***************
*** 106,112 ****
CREATE COLLATION alt_coll1 (locale = 'C');
CREATE COLLATION alt_coll2 (locale = 'C');
ALTER COLLATION alt_coll1 RENAME TO alt_coll2; -- failed (name conflict)
! ERROR: collation "alt_coll2" for encoding "SQL_ASCII" already exists in schema "alt_nsp1"
ALTER COLLATION alt_coll1 RENAME TO alt_coll3; -- OK
ALTER COLLATION alt_coll2 OWNER TO regtest_alter_user2; -- failed (no role membership)
ERROR: must be member of role "regtest_alter_user2"
--- 106,112 ----
CREATE COLLATION alt_coll1 (locale = 'C');
CREATE COLLATION alt_coll2 (locale = 'C');
ALTER COLLATION alt_coll1 RENAME TO alt_coll2; -- failed (name conflict)
! ERROR: collation "alt_coll2" for encoding "UTF8" already exists in schema "alt_nsp1"
ALTER COLLATION alt_coll1 RENAME TO alt_coll3; -- OK
ALTER COLLATION alt_coll2 OWNER TO regtest_alter_user2; -- failed (no role membership)
ERROR: must be member of role "regtest_alter_user2"
***************
*** 125,131 ****
ALTER COLLATION alt_coll3 SET SCHEMA alt_nsp2; -- failed (not owner)
ERROR: must be owner of collation alt_coll3
ALTER COLLATION alt_coll2 SET SCHEMA alt_nsp2; -- failed (name conflict)
! ERROR: collation "alt_coll2" for encoding "SQL_ASCII" already exists in schema "alt_nsp2"
RESET SESSION AUTHORIZATION;
SELECT n.nspname, c.collname, a.rolname
FROM pg_collation c, pg_namespace n, pg_authid a
--- 125,131 ----
ALTER COLLATION alt_coll3 SET SCHEMA alt_nsp2; -- failed (not owner)
ERROR: must be owner of collation alt_coll3
ALTER COLLATION alt_coll2 SET SCHEMA alt_nsp2; -- failed (name conflict)
! ERROR: collation "alt_coll2" for encoding "UTF8" already exists in schema "alt_nsp2"
RESET SESSION AUTHORIZATION;
SELECT n.nspname, c.collname, a.rolname
FROM pg_collation c, pg_namespace n, pg_authid a
***************
*** 334,341 ****
ORDER BY nspname, opfname;
nspname | opfname | amname | rolname
----------+----------+--------+---------------------
! alt_nsp1 | alt_opc1 | hash | kaigai
! alt_nsp1 | alt_opc2 | hash | kaigai
alt_nsp1 | alt_opf2 | hash | regtest_alter_user2
alt_nsp1 | alt_opf3 | hash | regtest_alter_user1
alt_nsp1 | alt_opf4 | hash | regtest_alter_user2
--- 334,341 ----
ORDER BY nspname, opfname;
nspname | opfname | amname | rolname
----------+----------+--------+---------------------
! alt_nsp1 | alt_opc1 | hash | alvherre
! alt_nsp1 | alt_opc2 | hash | alvherre
alt_nsp1 | alt_opf2 | hash | regtest_alter_user2
alt_nsp1 | alt_opf3 | hash | regtest_alter_user1
alt_nsp1 | alt_opf4 | hash | regtest_alter_user2

======================================================================

--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2012-09-27 20:58:23 Re: ToDo: allow to get a number of processed rows by COPY statement [Review of Patch]
Previous Message Andrew Dunstan 2012-09-27 20:18:45 Re: data to json enhancements