From: | Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com> |
---|---|
To: | Devi Munandar <devi(at)informatika(dot)lipi(dot)go(dot)id> |
Cc: | <pgsql-admin(at)postgresql(dot)org> |
Subject: | Re: change field type and length |
Date: | 2003-04-18 05:51:47 |
Message-ID: | 20030417224828.E97534-100000@megazone23.bigpanda.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
On Fri, 18 Apr 2003, Devi Munandar wrote:
> I've created table with postgresql, and so far so good, but I want to change
> Field type and field length, I've tried to find command line and
> documentation postgresql to change table field, but I can't get it. so there
> are any trip to change that field...?
>
> CREATE TABLE "dat_jab" (
> "code_jab" numeric(2,0) NOT NULL,
> "nm_jab" varchar(25),
> CONSTRAINT "dat_jab_pkey" PRIMARY KEY ("code_jab")
> );
> CREATE INDEX "dat_jab_code_jab_key" ON "dat_jab" ("code_jab");
>
> *** want to change Field Type "code_jab" numeric(4.0) , and field name
> "nm_jab" -->"nm_cdjab"
Renaming should be easy with ALTER TABLE RENAME COLUMN. For changing the
field type, I think about the best you can do is making a new column with
the correct new type, copy the data across and drop the old column.
From | Date | Subject | |
---|---|---|---|
Next Message | Derek Hamilton | 2003-04-18 18:24:01 | Performance Expectations |
Previous Message | Michiel Lange | 2003-04-18 05:23:32 | Re: change field type and length |