Subject: Data type conversion troubles.

From: Ususrio OPOSTGRES proyectos <[email-masked]>
Date: Wed, 14 Apr 93 19:29:17 METDST

Hi,
We are having troubles trying to convert an attribute from a type to another.

For example, try this:

 create foo(x=float4,n=int2)\g
 define rule trial is
              on append to foo
              do replace current( x= current.x * current.n )\g

The backend complains:

NOTICE:Apr 14 19:20:27:there is no operator * for types float4 and int2
NOTICE:Apr 14 19:20:27:You will either have to retype this query using an
NOTICE:Apr 14 19:20:27:explicit cast, or you will have to define the operator
WARN:Apr 14 19:20:27:* for float4 and int2 using DEFINE OPERATOR

If I try to convert attribute n from int2 to float4:

 define rule trial is
              on append to foo
              do replace current( x= current.x * (current.n::float4) )\g
We get a different error:

WARN:Apr 14 19:24:33:parser: syntax error at or near "::"

What's the problem with this? Does conversion operator :: work only with 
constants as in: "1"::float4?

How may I get my rule to work? Is there a conversion function between int2 and
float4?

	Thanks for any help.
-------
         Fernando Ariznavarreta Fernandez.
         School of Mining Engineers.
         University of Oviedo.
         Spain.