pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Victor Yegorov <viy@pirmabanka.lv>
To: Marc Soler <msoler@el-valles.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: About changing type af a column
Date: Wed, 26 Mar 2003 11:56:06 +0200
Message-ID: <20030326095606.GH1556@pirmabanka.lv> (raw)
In-Reply-To: <03b401c2f37b$97512640$0300a8c0@terra>
References: <03b401c2f37b$97512640$0300a8c0@terra>

* Marc Soler <msoler@el-valles.com> [26.03.2003 11:48]:
> Hi all,
> 
> I need to change a column length.
> 
> >From varchar(150) to varchar(250).
> 
> It's easy to change with an ALTER command? Or I need to create a new column,
> copy all data from the old column to the new one, then drop the old and
> rename the new.
> 
> If only exists the second solutions, the new column it will be created last
> one of the columns, then I must change all INSERT and UPDATE commands in my
> application.

How order of fields in the table can affect UPDATE statements?

About INSERTs - it's a good thing to specify all fields being inserted just
to prevent 'inconveniences' like you've mentioned.

> It's possible to create a column in a given position in the columns
> structure of a table?.

Yes. create a new table with same design except for the field you'd like to
change, than copy all data into new table, drop old one and rename new one.

> 
> Thanks in advance.

-- 

Victor Yegorov

view thread (4+ messages)  latest in thread

Message-ID: <20030326095606.GH1556@pirmabanka.lv>
Permalink:  ../20030326095606.GH1556@pirmabanka.lv/
Also on:    postgresql.org/message-id/20030326095606.GH1556@pirmabanka.lv

 · 

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: viy@pirmabanka.lv, msoler@el-valles.com
  Subject: Re: About changing type af a column
  In-Reply-To: <20030326095606.GH1556@pirmabanka.lv>
  References: <03b401c2f37b$97512640$0300a8c0@terra> <20030326095606.GH1556@pirmabanka.lv>

* 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