sqlpostgresqlplpgsqlpostgresql-8.4

Send variables to a function, casting?


In one place I have

CREATE FUNCTION updateGeo2(text, float4, float4) RETURNS float AS $$

followed later by

SELECT updateGeo2('area', 40.88, -90.56);

and I get

error : ERROR:  function updategeo2(unknown, numeric, numeric) does not exist

So it doesn't know that I tried to pass in a text variable, followed by a float variable and another float variable, it sees these as "unknown, numeric and numeric", lame. How do I let it know the types I am passing in?


Solution

  • try this way:

    SELECT updateGeo2('area', (40.88)::float4, (-90.56)::float4);