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

* alter column witdh
@ 2003-05-27 14:38 ` Eric Anderson Vianet SAO <eric@vianet-express.com.br>
  1 sibling, 0 replies; 3+ messages in thread

From: Eric Anderson Vianet SAO @ 2003-05-27 14:38 UTC (permalink / raw)
  To: pgsql-sql

how can I alter the column width

i´ve tried

alter table tablename alter columnname varchar(2)

but it returns errors

tnx.

Eric Anderson Martins Miranda
Net Admin @ Via Net SAO




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

* Re: alter column witdh
@ 2003-05-27 15:17 ` Frank Bax <fbax@sympatico.ca>
  1 sibling, 0 replies; 3+ messages in thread

From: Frank Bax @ 2003-05-27 15:17 UTC (permalink / raw)
  To: pgsql-sql

At 10:38 AM 5/27/03, Eric Anderson Vianet SAO wrote:
 >how can I alter the column width

http://techdocs.postgresql.org/techdocs/updatingcolumns.php

fbax=# create table tablename (columnname text);
CREATE
fbax=# \d tablename
       Table "tablename"
  Attribute  | Type | Modifier
------------+------+----------
  columnname | text |

fbax=# \q

pg_dump -o -c -s -t tablename fbax | sed "s:\"columnname\" 
text:\"columnname\" varchar(2):" | psql

Frank 




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

* Re: alter column witdh
@ 2003-05-27 15:07 Christoph Haller <ch@rodos.fzk.de>
  0 siblings, 0 replies; 3+ messages in thread

From: Christoph Haller @ 2003-05-27 15:07 UTC (permalink / raw)
  To: pgsql-sql; +Cc: eric@vianet-express.com.br

 >
 > how can I alter the column width
 >
Something like

begin ;

alter table foo rename column b to b_old ;
alter table foo add column b_new character(20) ;
update foo set b_new = b_old ;
alter table foo drop column b_old ;
alter table foo rename column b_new to b ;

commit ;

does the trick. Refer to the archives too.

Regards, Christoph





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


end of thread, other threads:[~2003-05-27 15:17 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-05-27 14:38 ` Eric Anderson Vianet SAO <eric@vianet-express.com.br>
2003-05-27 15:17 ` Frank Bax <fbax@sympatico.ca>
2003-05-27 15:07 Re: alter column witdh Christoph Haller <ch@rodos.fzk.de>

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