pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
changing column size and type.
7+ messages / 3 participants
[nested] [flat]

* changing column size and type.
@ 2003-04-15 14:21  pginfo <pginfo@t1.unisoftbg.com>
  0 siblings, 1 reply; 7+ messages in thread

From: pginfo @ 2003-04-15 14:21 UTC (permalink / raw)
  To: pgsql-sql

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.




^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: changing column size and type.
@ 2003-04-15 23:13  George Weaver <georgew1@mts.net>
  parent: pginfo <pginfo@t1.unisoftbg.com>
  0 siblings, 1 reply; 7+ messages in thread

From: George Weaver @ 2003-04-15 23:13 UTC (permalink / raw)
  To: pginfo <pginfo@t1.unisoftbg.com>; pgsql-sql

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" <pginfo@t1.unisoftbg.com>
To: <pgsql-sql@postgresql.org>
Sent: Tuesday, April 15, 2003 9:21 AM
Subject: [SQL] changing column size and type.


> 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?
>
> http://www.postgresql.org/docs/faqs/FAQ.html
>




^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: changing column size and type.
@ 2003-04-16 04:43  pginfo <pginfo@t1.unisoftbg.com>
  parent: George Weaver <georgew1@mts.net>
  0 siblings, 1 reply; 7+ messages in thread

From: pginfo @ 2003-04-16 04:43 UTC (permalink / raw)
  To: George Weaver <georgew1@mts.net>; +Cc: pgsql-sql

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:

> 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" <pginfo@t1.unisoftbg.com>
> To: <pgsql-sql@postgresql.org>
> Sent: Tuesday, April 15, 2003 9:21 AM
> Subject: [SQL] changing column size and type.
>
> > 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?
> >
> > http://www.postgresql.org/docs/faqs/FAQ.html
> >




^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: changing column size and type.
@ 2003-04-16 05:57  Rudi Starcevic <rudi@oasis.net.au>
  parent: pginfo <pginfo@t1.unisoftbg.com>
  0 siblings, 1 reply; 7+ messages in thread

From: Rudi Starcevic @ 2003-04-16 05:57 UTC (permalink / raw)
  To: pginfo <pginfo@t1.unisoftbg.com>; +Cc: pgsql-sql

Ivan,

This link show's how to do it online.

http://www.edoceo.com/liberum/default.php?doc=postgresql-tricks

There are other links around too.

Cheers
Rudi


pginfo wrote:

>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:
>
>  
>
>>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" <pginfo@t1.unisoftbg.com>
>>To: <pgsql-sql@postgresql.org>
>>Sent: Tuesday, April 15, 2003 9:21 AM
>>Subject: [SQL] changing column size and type.
>>
>>    
>>
>>>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?
>>>
>>>http://www.postgresql.org/docs/faqs/FAQ.html
>>>
>>>      
>>>
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 5: Have you checked our extensive FAQ?
>
>http://www.postgresql.org/docs/faqs/FAQ.html
>
>  
>

^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: changing column size and type.
@ 2003-04-16 09:16  pginfo <pginfo@t1.unisoftbg.com>
  parent: Rudi Starcevic <rudi@oasis.net.au>
  0 siblings, 1 reply; 7+ messages in thread

From: pginfo @ 2003-04-16 09:16 UTC (permalink / raw)
  To: Rudi Starcevic <rudi@oasis.net.au>; +Cc: pgsql-sql

Hi Rudi,

I readet the doc, but it is about how to ann new column.
That is well documented in pgDoc's.

I will to change the column type of existing column.
For example if my columnt was declared as int4, I will to change it to
int8.
Or if it was varchar(20) I will to make it varchar(100) and so on.
Also I will it without to dump the db.

regards,
ivan.

Rudi Starcevic wrote:

>  Ivan,
>
> This link show's how to do it online.
>
> http://www.edoceo.com/liberum/default.php?doc=postgresql-tricks
>
> There are other links around too.
>
> Cheers
> Rudi
>
>
> pginfo wrote:
>
>> 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:
>>
>>
>> > 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" <pginfo@t1.unisoftbg.com>
>> > To: <pgsql-sql@postgresql.org>
>> > Sent: Tuesday, April 15, 2003 9:21 AM
>> > Subject: [SQL] changing column size and type.
>> >
>> >
>> >>  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?
>> >>
>> >>  http://www.postgresql.org/docs/faqs/FAQ.html
>> >>
>> >>
>>
>> ---------------------------(end of
>> broadcast)---------------------------
>> TIP 5: Have you checked our extensive FAQ?
>>
>> http://www.postgresql.org/docs/faqs/FAQ.html
>>
>>
>

^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: changing column size and type.
@ 2003-04-16 12:52  pginfo <pginfo@t1.unisoftbg.com>
  parent: Rudi Starcevic <rudi@oasis.net.au>
  0 siblings, 0 replies; 7+ messages in thread

From: pginfo @ 2003-04-16 12:52 UTC (permalink / raw)
  To: Rudi Starcevic <rudi@oasis.net.au>; +Cc: pgsql-sql

Hi Rudi,

I think it is good solution for now.

Many thanks,
ivan.

Rudi Starcevic wrote:

> Ivan,
>
> Oops sorry about that ..
> I should have read your email closer.
> Have you seen Joel Burton's doc at:
> http://techdocs.postgresql.org/techdocs/updatingcolumns.php
>
> Looks like you may need to use temporary tables and move
> the data back and forth.
>
> That's the way I do it.
> I'm pretty sure this also how it's done using the phpPgAdmin
> web admin tool.
> I guess since phpPgAdmin's a web tool the task is achieved 'online'.
>
> Cheers
> Best regards
> Rudi.
>
> > Hi Rudi,
> >
> > I readet the doc, but it is about how to ann new column.
> > That is well documented in pgDoc's.
> >
> > I will to change the column type of existing column.
> > For example if my columnt was declared as int4, I will to change it
> > to int8. Or if it was varchar(20) I will to make it varchar(100) and
> > so on. Also I will it without to dump the db.
> >
> > regards,
> > ivan.
> >
> > Rudi Starcevic wrote:
> >
> > >  Ivan,
> > >
> > > This link show's how to do it online.
> > >
> > > http://www.edoceo.com/liberum/default.php?doc=postgresql-tricks
> > >
> > > There are other links around too.
> > >
> > > Cheers
> > > Rudi
> > >
> > >
> > > pginfo wrote:
> > >
> > >> 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:
> > >>
> > >>
> > >> > 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" <pginfo@t1.unisoftbg.com>
> > >> > To: <pgsql-sql@postgresql.org>
> > >> > Sent: Tuesday, April 15, 2003 9:21 AM
> > >> > Subject: [SQL] changing column size and type.
> > >> >
> > >> >
> > >> >>  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?
> > >> >>
> > >> >>  http://www.postgresql.org/docs/faqs/FAQ.html
> > >> >>
> > >> >>
> > >>
> > >> ---------------------------(end of
> > >> broadcast)---------------------------
> > >> TIP 5: Have you checked our extensive FAQ?
> > >>
> > >> http://www.postgresql.org/docs/faqs/FAQ.html
> > >>
> > >>
> > >
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)




^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: changing column size and type.
@ 2003-04-16 13:09  Rudi Starcevic <rudi@oasis.net.au>
  parent: pginfo <pginfo@t1.unisoftbg.com>
  0 siblings, 1 reply; 7+ messages in thread

From: Rudi Starcevic @ 2003-04-16 13:09 UTC (permalink / raw)
  To: pginfo <pginfo@t1.unisoftbg.com>; +Cc: pgsql-sql

Ivan,

Oops sorry about that ..
I should have read your email closer.
Have you seen Joel Burton's doc at:
http://techdocs.postgresql.org/techdocs/updatingcolumns.php

Looks like you may need to use temporary tables and move
the data back and forth.

That's the way I do it.
I'm pretty sure this also how it's done using the phpPgAdmin
web admin tool.
I guess since phpPgAdmin's a web tool the task is achieved 'online'.

Cheers
Best regards
Rudi.


> Hi Rudi,
> 
> I readet the doc, but it is about how to ann new column.
> That is well documented in pgDoc's.
> 
> I will to change the column type of existing column.
> For example if my columnt was declared as int4, I will to change it 
> to int8. Or if it was varchar(20) I will to make it varchar(100) and 
> so on. Also I will it without to dump the db.
> 
> regards,
> ivan.
> 
> Rudi Starcevic wrote:
> 
> >  Ivan,
> >
> > This link show's how to do it online.
> >
> > http://www.edoceo.com/liberum/default.php?doc=postgresql-tricks
> >
> > There are other links around too.
> >
> > Cheers
> > Rudi
> >
> >
> > pginfo wrote:
> >
> >> 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:
> >>
> >>
> >> > 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" <pginfo@t1.unisoftbg.com>
> >> > To: <pgsql-sql@postgresql.org>
> >> > Sent: Tuesday, April 15, 2003 9:21 AM
> >> > Subject: [SQL] changing column size and type.
> >> >
> >> >
> >> >>  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?
> >> >>
> >> >>  http://www.postgresql.org/docs/faqs/FAQ.html
> >> >>
> >> >>
> >>
> >> ---------------------------(end of
> >> broadcast)---------------------------
> >> TIP 5: Have you checked our extensive FAQ?
> >>
> >> http://www.postgresql.org/docs/faqs/FAQ.html
> >>
> >>
> >




^ permalink  raw  reply  [nested|flat] 7+ messages in thread


end of thread, other threads:[~2003-04-16 13:09 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-04-15 14:21 changing column size and type. pginfo <pginfo@t1.unisoftbg.com>
2003-04-15 23:13 ` George Weaver <georgew1@mts.net>
2003-04-16 04:43   ` pginfo <pginfo@t1.unisoftbg.com>
2003-04-16 05:57     ` Rudi Starcevic <rudi@oasis.net.au>
2003-04-16 09:16       ` pginfo <pginfo@t1.unisoftbg.com>
2003-04-16 13:09         ` Rudi Starcevic <rudi@oasis.net.au>
2003-04-16 12:52           ` pginfo <pginfo@t1.unisoftbg.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox