pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Changing data type must recreate all views?
3+ messages / 3 participants
[nested] [flat]

* Changing data type must recreate all views?
@ 2003-08-13 16:51 Yudie <yudie@axiontech.com>
  2003-08-19 07:53 ` Re: Changing data type must recreate all views? Peter Eisentraut <peter_e@gmx.net>
  0 siblings, 1 reply; 3+ messages in thread

From: Yudie @ 2003-08-13 16:51 UTC (permalink / raw)
  To: pgsql-sql

I need to change column data type from integer to float8
That mean to droping table and recreate a new one and can lost the original
object id.
Do i need to recreate all views and triggers that relate to that table?
if that so, is there anyway to do that without touching views and triggers?


Thanks,
yudie






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

* Re: Changing data type must recreate all views?
  2003-08-13 16:51 Changing data type must recreate all views? Yudie <yudie@axiontech.com>
@ 2003-08-19 07:53 ` Peter Eisentraut <peter_e@gmx.net>
  0 siblings, 0 replies; 3+ messages in thread

From: Peter Eisentraut @ 2003-08-19 07:53 UTC (permalink / raw)
  To: Yudie <yudie@axiontech.com>; +Cc: pgsql-sql

Yudie writes:

> I need to change column data type from integer to float8
> That mean to droping table and recreate a new one and can lost the original
> object id.
> Do i need to recreate all views and triggers that relate to that table?
> if that so, is there anyway to do that without touching views and triggers?

Not really.

Perhaps it will be easier if you do a dump of the affected objects, edit
the dump file, and reload.

-- 
Peter Eisentraut   peter_e@gmx.net



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

* Re: Changing data type must recreate all views?
@ 2003-08-14 15:18 Christoph Haller <ch@rodos.fzk.de>
  0 siblings, 0 replies; 3+ messages in thread

From: Christoph Haller @ 2003-08-14 15:18 UTC (permalink / raw)
  To: pgsql-sql; yudie@axiontech.com

>
> I need to change column data type from integer to float8
> That mean to droping table and recreate a new one and can lost the
original
> object id.
> Do i need to recreate all views and triggers that relate to that
table?
> if that so, is there anyway to do that without touching views and
triggers?
>
No, you don't have to drop and re-create.
How about
ALTER TABLE yourTable ADD COLUMN yourNewColumn double precision ;
UPDATE yourTable SET yourNewColumn = yourOldColumn ;
ALTER TABLE yourTable DROP COLUMN yourOldColumn ;
ALTER TABLE yourTable RENAME COLUMN yourNewColumn TO yourOldColumn ;

Views and triggers should work AFAIK, but if there are procedures
referencing the data type
of yourOldColumn, you have to re-create them changing the parameter type
from
integer to double precision.

Regards, Christoph






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


end of thread, other threads:[~2003-08-19 07:53 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-08-13 16:51 Changing data type must recreate all views? Yudie <yudie@axiontech.com>
2003-08-19 07:53 ` Peter Eisentraut <peter_e@gmx.net>
2003-08-14 15:18 Re: Changing data type must recreate all views? 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