From: Tom Lane <tgl@sss.pgh.pa.us>
To: Kevin Grittner <Kevin.Grittner@wicourts.gov>
Cc: pgsql-docs@postgresql.org, "Robert Treat" <xzilla@users.sourceforge.net>
Subject: Re: ALTER TABLE x ALTER COLUMN y TYPE z
Date: Wed, 22 Mar 2006 15:14:44 -0500
Message-ID: <19259.1143058484@sss.pgh.pa.us> (raw)
In-Reply-To: <442158A9.EE98.0025.0@wicourts.gov>
References: <44213BD5.EE98.0025.0@wicourts.gov>
<200603221400.33513.xzilla@users.sourceforge.net>
<442158A9.EE98.0025.0@wicourts.gov>
"Kevin Grittner" <Kevin.Grittner@wicourts.gov> writes:
> The user comment's recommended technique includes this line:
> ALTER TABLE tab DROP COLUMN temp_name;
> Would this cause a table rewrite? (Not a rhetorical question. I
> really don't know.)
No, it wouldn't. The UPDATE is the only part that modifies the table
contents.
However, the arguments Robert pointed to had to do with concurrent
access to the table, and somehow I am not seeing the use-case for ALTER
COLUMN TYPE on a table that's being actively used by other clients.
It seems unlikely that you could do that without needing to also update
your client software. I'd be a tad worried about stale-cached-plan
problems too, in current PG releases. Finally, since the first ALTER
will take an exclusive lock that won't be released until COMMIT, this
approach doesn't avoid the problem of holding exclusive lock for a long
time.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-docs@postgresql.org
Cc: tgl@sss.pgh.pa.us, Kevin.Grittner@wicourts.gov, xzilla@users.sourceforge.net
Subject: Re: ALTER TABLE x ALTER COLUMN y TYPE z
In-Reply-To: <19259.1143058484@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox