pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stephan Szabo <sszabo@megazone23.bigpanda.com>
To: Devi Munandar <devi@informatika.lipi.go.id>
Cc: pgsql-admin@postgresql.org
Subject: Re: change field type and length
Date: Thu, 17 Apr 2003 22:51:47 -0700 (PDT)
Message-ID: <20030417224828.E97534-100000@megazone23.bigpanda.com> (raw)
In-Reply-To: <003301c30569$43003d60$a6f0cda7@informatika.lipi.go.id>


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.




view thread (3+ messages)

Message-ID: <20030417224828.E97534-100000@megazone23.bigpanda.com>
Permalink:  ../20030417224828.E97534-100000@megazone23.bigpanda.com/
Also on:    postgresql.org/message-id/20030417224828.E97534-100000@megazone23.bigpanda.com

 · 

reply

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: sszabo@megazone23.bigpanda.com, devi@informatika.lipi.go.id
  Subject: Re: change field type and length
  In-Reply-To: <20030417224828.E97534-100000@megazone23.bigpanda.com>
  References: <003301c30569$43003d60$a6f0cda7@informatika.lipi.go.id> <20030417224828.E97534-100000@megazone23.bigpanda.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