Error match in pg_typeof

SELECT
CASE WHEN pg_typeof(id)::text = 'geography' THEN ST_AsText(id) 
ELSE id::text 
END AS bool_location 
FROM shop

called Result::unwrap() on an Err value: Error { kind: Db, cause: Some(DbError { severity: “ERROR”, parsed_severity: Some(Error), code: SqlState(E42883), message: “function st_astext(uuid) does not exist”, detail: None, hint: Some(“No function matches the given name and argument types. You might need to add explicit type casts.”), position: Some(Original(62)), where_: None, schema: None, table: None, column: None, datatype: None, constraint: None, file: Some(“parse_func.c”), line: Some(636), routine: Some(“ParseFuncOrColumn”) }) }

but the uuid is not in geography then why its is true

postgres=# select * from demo;
 i  
----
 42
(1 Zeile)

postgres=# select pg_typeof(i) as typ from demo limit 1;
   typ   
---------
 integer
(1 Zeile)

postgres=# 

works for me.

please switch to german, this is a german speaking forum!

What is the data type definition of the column id? I assume it’s text or something like that. As you can’t store values of different types in one column, pg_typeof() will always return the “original” defined data type.

Im Übrigen ist das ein deutschsprachiges Forum, es wäre nett wenn Du auf Deutsch schreiben würdest.

Dieses Thema wurde automatisch 60 Tage nach der letzten Antwort geschlossen. Es sind keine neuen Antworten mehr erlaubt.