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
Views: Raw Message | Whole Thread | Download mbox | Resend email
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

Browse pgsql-novice by date

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