From: Keaton Adams <kadams@mxlogic.com>
To: pgsql-admin@postgresql.org
Subject: ALTER TABLE - ALTER COLUMN question
Date: Tue, 29 May 2007 14:42:13 -0600
Message-ID: <1180471333.19986.13.camel@MXLRMT-208.corp.mxlogic.com> (raw)
When I issue an alter table ..... alter column command, the table
contents are copied from the old structure to the new, correct? So I
need 2x the table space available so the old and new tables can exist at
the same time? PostgreSQL doesn't use an in-place alter-table for these
types of changes, correct?
In this example the created and msg_datetime columns are currently
defined as TIMESTAMP WITHOUT TIME ZONE and no default. If the alter
table for these changes is not in-place then I would want to run it as a
single alter with all of the changes, such as this, instead of
individual alters for each change, correct? (Because each individual
alter would require another table copy?)
ALTER TABLE my_table ALTER COLUMN created TYPE TIMESTAMP WITH TIME
ZONE,
ALTER COLUMN created SET DEFAULT ('now'::text)::TIMESTAMP(6) WITH
TIME ZONE,
ALTER COLUMN msg_datetime TYPE TIMESTAMP WITH TIME ZONE,
ALTER COLUMN msg_datetime SET DEFAULT ('now'::text)::TIMESTAMP(6) WITH
TIME ZONE;
Thanks,
Keaton
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-admin@postgresql.org
Cc: kadams@mxlogic.com
Subject: Re: ALTER TABLE - ALTER COLUMN question
In-Reply-To: <1180471333.19986.13.camel@MXLRMT-208.corp.mxlogic.com>
* 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