Re: changing column size and type. - Mailing list pgsql-sql

From pginfo
Subject Re: changing column size and type.
Date
Msg-id 3E9D1F55.9582B0E6@t1.unisoftbg.com
Whole thread Raw
In response to changing column size and type.  (pginfo <pginfo@t1.unisoftbg.com>)
Responses Re: changing column size and type.
List pgsql-sql
Hi Rudi, <p>I readet the doc, but it is about how to ann new column. <br />That is well documented in pgDoc's. <p>I
willto change the column type of existing column. <br />For example if my columnt was declared as int4, I will to
changeit to int8. <br />Or if it was varchar(20) I will to make it varchar(100) and so on. <br />Also I will it without
todump the db. <p>regards, <br />ivan. <p>Rudi Starcevic wrote: <blockquote type="CITE"> Ivan, <p>This link show's how
todo it online. <p><a class="moz-txt-link-freetext"
href="http://www.edoceo.com/liberum/default.php?doc=postgresql-tricks">http://www.edoceo.com/liberum/default.php?doc=postgresql-tricks</a><p>There
areother links around too. <p>Cheers <br />Rudi <br />  <p>pginfo wrote: <blockquote
cite="mid3E9CDF76.C2B2D50@t1.unisoftbg.com"type="cite"><pre wrap="">Hi George,
 

It is possible to do it so, but I wanted some better solution.
For example with oracle I can do it "online".

regards,
ivan.

George Weaver wrote:

</pre><blockquote type="cite"><pre wrap="">Hi Ivan,

I don't know if this is a recommended practice or not, but you can try the
following.

Use PgDump to back up the entire database as a text file.  Edit the backup
text file and change the CREATE TABLE statement for the table you want to
change, changing the column width to the new width desired.  Restore the
database.  The database will be restored with the new width for the column
in the table.

The ability to do this depends on the size of the database, whether it can
be taken off line, etc. etc.

HTH
George

----- Original Message -----
From: "pginfo" <a class="moz-txt-link-rfc2396E" href="mailto:pginfo@t1.unisoftbg.com"><pginfo@t1.unisoftbg.com>
</a>To: <a class="moz-txt-link-rfc2396E" href="mailto:pgsql-sql@postgresql.org"><pgsql-sql@postgresql.org>
</a>Sent: Tuesday, April 15, 2003 9:21 AM
Subject: [SQL] changing column size and type.

</pre><blockquote type="cite"><pre wrap="">Hi,

I am using pg 7.3.2.

Is it possible to change:
- column size ot existing table.
- columnt size ( it is varchar basicaly).

The problem is that the table have many freferences from and to it.

many thanks,
ivan.


---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

<a class="moz-txt-link-freetext"
href="http://www.postgresql.org/docs/faqs/FAQ.html">http://www.postgresql.org/docs/faqs/FAQ.html

</a></pre></blockquote></blockquote><pre wrap="">

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

<a class="moz-txt-link-freetext"
href="http://www.postgresql.org/docs/faqs/FAQ.html">http://www.postgresql.org/docs/faqs/FAQ.html

</a></pre></blockquote>  </blockquote>  

pgsql-sql by date:

Previous
From: friedrich nietzsche
Date:
Subject: Re: connecting to a differnt DB in PL/pgSQL
Next
From: rute solipa
Date:
Subject: HELP