X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E4F4152805 for ; Tue, 24 May 2005 04:56:14 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 59189-10 for ; Tue, 24 May 2005 07:56:06 +0000 (GMT) Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) by svr1.postgresql.org (Postfix) with ESMTP id CE1A8528A7 for ; Tue, 24 May 2005 04:56:01 -0300 (ADT) Received: from mainbox.archonet.com (84-51-143-99.archon037.adsl.metronet.co.uk [84.51.143.99]) by smtp.metronet.co.uk (MetroNet Mail) with ESMTP id BDC5B40C116; Tue, 24 May 2005 08:55:58 +0100 (BST) Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id D884515EA6; Tue, 24 May 2005 08:45:46 +0100 (BST) Received: from mainbox.archonet.com ([127.0.0.1]) by localhost (mainbox [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 17603-08; Tue, 24 May 2005 08:45:46 +0100 (BST) Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 9692815EA5; Tue, 24 May 2005 08:45:46 +0100 (BST) Message-ID: <4292DBAA.7030408@archonet.com> Date: Tue, 24 May 2005 08:45:46 +0100 From: Richard Huxton User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Timo Roessner Cc: pgsql-sql@postgresql.org Subject: Re: datatype conversion on postgresql 7.4.1 References: <42906D06.3090200@gmx.net> In-Reply-To: <42906D06.3090200@gmx.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.054 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200505/197 X-Sequence-Number: 21510 Timo Roessner wrote: > and if i try something like: > > alter table fragment alter column x type numeric(15,2) > > i get an syntax error, so this seems to be no feature in 7.4.1 (didnt > find anything like that in the docs too....) > > what can i do to solve this? there must be some way in postgresql 7.4.1, > if there is no way to do that, i have to > build up the whole database from scratch........there must be a way to > convert float to numeric values in 7.4.1 , > but i dont have a single clue... There isn't a way to directly convert the type of a column in 7.4.x but you can duplicate the effect. BEGIN; ALTER TABLE fragment RENAME COLUMN x TO old_x; ALTER TABLE fragment ADD COLUMN x numeric(10,2); UPDATE fragment SET x = old_x; ALTER TABLE fragment DROP COLUMN old_x; COMMIT; Make sure you check any functions/application code that might be expecting floating-point rather than numeric before you do this. Oh, and upgrade from 7.4.1 to 7.4.7 as soon as possible. -- Richard Huxton Archonet Ltd