Ash FrameworkAF
Ash Framework7mo ago
38 replies
nicolkill

indeterminate_datatype with fragment using the PosGIS

i need determine if a record its inside a polygon that its a param from the call, but returns ERROR 42P18 (indeterminate_datatype) could not determine data type of parameter $1 and dont really know why its happening, i tried on direct sql query and works well with the format and returns the polygon, so dont know why fails with on the format

i think that maybe its injecting like POLYGON(("latitude longitude,latitude longitude") and maybe quotes its making some conflict but dont really know, same query with same data but in direct sql its working

  calculate :inside_polygon,
              :boolean,
              expr(
                fragment(
                  "ST_Intersects(ST_GeomFromText('POLYGON((?))', 4326), ?)",
                  ^arg(:polygon),
                  coordinates
                )
              ) do
      argument :polygon, :string, allow_nil?: false
      public? true
    end


coordinates its a value of type :geometry
polygon argument its a string but in format latitude longitude,latitude longitude,...

the error generates this query of the calculation
Was this page helpful?