Thread: pg_dumpall problems

pg_dumpall problems

From
g
Date:
I need to know how to cast types. Here's my basic problem:
I'm trying to:

update products set list_price = gsa_price * 1.1 where list_price =
gsa_price;

The error I get back is:

ERROR:  Unable to identify an operator '*' for types 'numeric' and
'float8' You will have to retype this query using an explicit cast

So, I'm assuming that I need to cast the value 1.1 as a numeric so that I
will be multiplying a numeric times a numeric.

Then I realized I had no idea what the syntax to do the cast was.

Thanks for info


-----------------------------------------
Water overcomes the stone;
Without substance it requires no opening;
This is the benefit of taking no action.
            Lao-Tse

Brian Knox
Senior Systems Engineer
brian@govshops.com


Re: pg_dumpall problems

From
Stephan Szabo
Date:
I believe the standard way is
CAST(1.1 as numeric)

But the following should also work:
1.1::numeric

Stephan Szabo
sszabo@bigpanda.com

On Tue, 15 Aug 2000, g wrote:

> I need to know how to cast types. Here's my basic problem:
> I'm trying to:
>
> update products set list_price = gsa_price * 1.1 where list_price =
> gsa_price;
>
> The error I get back is:
>
> ERROR:  Unable to identify an operator '*' for types 'numeric' and
> 'float8' You will have to retype this query using an explicit cast
>
> So, I'm assuming that I need to cast the value 1.1 as a numeric so that I
> will be multiplying a numeric times a numeric.
>
> Then I realized I had no idea what the syntax to do the cast was.


Re: pg_dumpall problems

From
g
Date:
Thanks. I figured out the CAST later but didn't know the 1.1::numeric
syntax.

-----------------------------------------
Water overcomes the stone;
Without substance it requires no opening;
This is the benefit of taking no action.
            Lao-Tse

Brian Knox
Senior Systems Engineer
brian@govshops.com

On Tue, 15 Aug 2000, Stephan Szabo wrote:

> I believe the standard way is
> CAST(1.1 as numeric)
>
> But the following should also work:
> 1.1::numeric
>
> Stephan Szabo
> sszabo@bigpanda.com
>
> On Tue, 15 Aug 2000, g wrote:
>
> > I need to know how to cast types. Here's my basic problem:
> > I'm trying to:
> >
> > update products set list_price = gsa_price * 1.1 where list_price =
> > gsa_price;
> >
> > The error I get back is:
> >
> > ERROR:  Unable to identify an operator '*' for types 'numeric' and
> > 'float8' You will have to retype this query using an explicit cast
> >
> > So, I'm assuming that I need to cast the value 1.1 as a numeric so that I
> > will be multiplying a numeric times a numeric.
> >
> > Then I realized I had no idea what the syntax to do the cast was.
>