From: | "Vladimir V(dot) Zolotych" <gsmith(at)eurocom(dot)od(dot)ua> |
---|---|
To: | Matthew <matt(at)ctlno(dot)com>, pgsql-admin(at)postgresql(dot)org |
Subject: | Re: Removing NOT NULL Contraint |
Date: | 2000-05-04 06:43:41 |
Message-ID: | 39111C1D.7C491269@eurocom.od.ua |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin pgsql-general |
When I need to change table (e.g. adding new column or changing col attr)
I used the following:
1) dump the table: pg_dump -t my_table > my_table.out
2) edit my_table slightly (e.g. remain only COPY statement)
3) delete table my_table (also my_table's sequences if any)
4) create table as it should be
5) populate table, e.g. pgsql -e my_db < my_table.out
6) setting sequences, etc. (e.g. select setval('my_table_sequence', ...))
If you will know more convinient way, please let me now.
Matthew wrote:
> I may be missing something simple here, but I have an attribute in a
> table that was created as NOT NULL. I now need to remove this
> constraint. I don't see a proper way to do this. I think I can update
> the pg_attribute table and change attnotnull from true to false. Is
> this an acceptable solution or is there a good reason that I should not
> directly edit the system tables?
>
> Maybe I'm missing something but I didn't see another way to do it other
> then creating a new table, selecting into it and dropping the old table,
> which seems like a lot of work for something so simple.
>
> Thanks,
>
> Matt
From | Date | Subject | |
---|---|---|---|
Next Message | Vladimir V. Zolotych | 2000-05-04 06:53:35 | arrays, not set |
Previous Message | Travis Bauer | 2000-05-03 20:40:41 | Basic trigger question |
From | Date | Subject | |
---|---|---|---|
Next Message | Jurgen Defurne | 2000-05-04 06:49:22 | Re: What do you think? |
Previous Message | Elijah Roberts | 2000-05-04 06:20:36 | lo_tell problem with JDBC and RC4 |