let location = format!("WITH current_location AS (
        SELECT ST_GeogFromText('SRID=4326;POINT(' ||$1|| ' ' ||$2|| ')') AS c_location
    )
    SELECT CASE WHEN pg_typeof(id) = 'geography' THEN ST_AsText(id) ELSE id::text END AS id_location,
CASE WHEN pg_typeof(location) = 'geography' THEN ST_AsText(location) ELSE location::text END AS bool_location,ST_Distance(location::geography, cl.c_location) as distance FROM shop , current_location cl");

called Result::unwrap() on an Err value: Error { kind: Db, cause: Some(DbError { severity: "ERROR", parsed_severity: Some(Error), code: SqlState(E22P02), message: "invalid input syntax for type oid: "geography"", detail: None, hint: None, position: Some(Original(158)), where_: None, schema: None, table: None, column: None, datatype: None, constraint: None, file: Some("numutils.c"), line: Some(921), routine: Some("uint32in_subr") })

1 post - 1 participant

Read full topic

Source: View source