From: | Patrick Nelson <pnelson(at)neatech(dot)com> |
---|---|
To: | "PostgreSQL List (E-mail)" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Alter table syntax |
Date: | 2002-10-23 17:15:03 |
Message-ID: | 4165C48DE9A0D211B6400800095C585F172E81@WASHINGTON |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Garo Hussenjian wrote:
----------------->>>>
Can anyone remind me how to make a column 'not null' after it is created?
----------------->>>>
>From an earlier email (search the archives for more)
HTH
<snip>................
I ultimately followed the dump-edit-recreate route which was much simpler
(and pretty darn fast also) than I thought it would be. I also went with
his process of using a recreate.sql file for this and future changes to any
of my databases. Based on Joel's email, here is the process I
followed:
1. Dump the database using:
pg_dump -S postgres <database name> > dbdump.sql
2. Created a file called recreate.sql which looks like:
DROP DATABASE <database name>;
CREATE DATABASE <database name> WITH TEMPLATE=template1;
\c <database name>
3. Added a \i recreate.sql to the top of dbdump.sql and then edited table
structure in question.
4. Run the command (just want to see errors):
echo "\i dbdump.sql" | psql template1 1>/dev/null
5. Re-dump using similar command in step 1 and diff the two dump files for a
sanity check
................<snip>
From | Date | Subject | |
---|---|---|---|
Next Message | Elielson Fontanezi | 2002-10-23 17:34:06 | shared memory number |
Previous Message | ilir gashi | 2002-10-23 16:55:33 | Request for List of Known Bugs |