Thread: a problem
hello
How do i change the definition of a column? one of the columns width is not sufficient to store the data. I want to change the width. how to do that in postgres? I tried doing alter table + change/modify. both of them doesn't work in postgres.
and what is the maximum size to which a postgres database can grow? I have huge data to store.
regards
sharvari
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
On Fri, 2003-08-22 at 05:01, sharvari N wrote: > hello > How do i change the definition of a column? one of the columns width is > not sufficient to store the data. I want to change the width. how to do > that in postgres? I tried doing alter table + change/modify. both of > them doesn't work in postgres. you have to hack the system tables for this, though i can't seem to recall the exact field name this morning. the query is certainly in the archives as i've answered this one before, if you were too lazy to look it up i guess i will be too ;-) > and what is the maximum size to which a postgres database can grow? I > have huge data to store. real big, most likely limited by your OS. i think the largest reported is like 4TB Robert Treat -- Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL
if your table is named foo and the field you want to chage is bar, then:
BEGIN;
ALTER TABLE foo RENAME bar TO bar_old;
ALTER TABLE foo ADD bar VARCHAR(<new_size>);
UPDATE foo SET bar=bar_old;
*if everything went ok then*
ALTER TABLE foo DROP bar_old;
COMMIT;
same goes for CHAR data type.
about limitations:
http://www.postgresql.org/users-lounge/limitations.html
On Fri, 2003-08-22 at 06:01, sharvari N wrote:
BEGIN;
ALTER TABLE foo RENAME bar TO bar_old;
ALTER TABLE foo ADD bar VARCHAR(<new_size>);
UPDATE foo SET bar=bar_old;
*if everything went ok then*
ALTER TABLE foo DROP bar_old;
COMMIT;
same goes for CHAR data type.
about limitations:
http://www.postgresql.org/users-lounge/limitations.html
On Fri, 2003-08-22 at 06:01, sharvari N wrote:
hello
How do i change the definition of a column? one of the columns width is not sufficient to store the data. I want to change the width. how to do that in postgres? I tried doing alter table + change/modify. both of them doesn't work in postgres.
and what is the maximum size to which a postgres database can grow? I have huge data to store.
regards
sharvari
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software