Skip site navigation (1) Skip section navigation (2)

Re: how to modify a field

From: Jason Earl <jason(dot)earl(at)simplot(dot)com>
To: "Terry BD7NQ" <bd7nq(at)hellocq(dot)net>
Cc: <pgsql-novice(at)postgresql(dot)org>
Subject: Re: how to modify a field
Date: 2002-01-07 18:21:40
Message-ID: 87y9ja81jf.fsf@npa01zz001.simplot.com (view raw or flat)
Thread:
Lists: pgsql-novice
Unfortunately there isn't really a good way to do this in PostgreSQL.
What you are probably going to end up doing is creating a temporary
table with the new schema that you want, copying that data to this new
table with an 'insert into' query, delete the old table, and rename
the new table.

You will probably also want to get rid of the sequence object that
your serial type created, and heaven help you if you had a pile of
triggers set for this table.

Good Luck,
Jason

"Terry BD7NQ" <bd7nq(at)hellocq(dot)net> writes:

> Hi Gentleman,
> 
> 1. How to modify a field in the table structure, such I have a filed name
> 'userid', its type is serial, now I want to change ti to varchar?
> 2. How to delete a field in the table structure?
> 
> Terry
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org

In response to

pgsql-novice by date

Next:From: David LinkDate: 2002-01-07 21:16:49
Subject: Postgres and XML
Previous:From: Terry BD7NQDate: 2002-01-07 08:09:50
Subject: how to modify a field

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group