pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Timo Roessner <timo.roessner@gmx.net>
To: pgsql-sql@postgresql.org
Subject: datatype conversion on postgresql 7.4.1
Date: Sun, 22 May 2005 13:29:10 +0200
Message-ID: <42906D06.3090200@gmx.net> (raw)

hi everybody,

i got the following problem:

i have a database running on a postgresqlserver version 7.4.1, in the 
database is a table with 4 columns containing
float-numbers. what i want to do now is,  to convert the type of those 
columns from float to numeric, because
i want to limit the positions after the decimal point to 2.

what works fine in v. 8:

either

alter table fragment alter column  x type numeric(15,2)

or

update fragment set x = round(x,2)

but both wont work with version 7.4.1!

when i look into the documentation it seems to say that in 7.4.1 round() 
can only round to a given number of positions after the decimal point 
when used with a numeric type, but not with floats!

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...

thx for any help in advance





view thread (2+ messages)  latest in thread

Message-ID: <42906D06.3090200@gmx.net>
Permalink:  ../42906D06.3090200@gmx.net/
Also on:    postgresql.org/message-id/42906D06.3090200@gmx.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: timo.roessner@gmx.net
  Subject: Re: datatype conversion on postgresql 7.4.1
  In-Reply-To: <42906D06.3090200@gmx.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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