# Error match in pg\_typeof

**URL:** https://www.pg-forum.de/t/error-match-in-pg-typeof/13108
**Category:** Unkategorisiert
**Created:** [22. Januar 2025 um 09:35 UTC](https://www.pg-forum.de/t/error-match-in-pg-typeof/13108 "2025-01-22T09:35:54Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![hari](https://www.pg-forum.de/letter_avatar_proxy/v4/letter/h/cdc98d/32.png) [@hari](https://www.pg-forum.de/u/hari)
#### Post date: [22. Januar 2025 um 09:35 UTC](https://www.pg-forum.de/t/error-match-in-pg-typeof/13108/1 "2025-01-22T09:35:54Z")

</div>

```auto
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

---

<div class="post-metadata">

### Author: ![akretschmer](https://www.pg-forum.de/letter_avatar_proxy/v4/letter/a/a6a055/32.png) [@akretschmer](https://www.pg-forum.de/u/akretschmer)
#### Post date: [22. Januar 2025 um 09:52 UTC](https://www.pg-forum.de/t/error-match-in-pg-typeof/13108/2 "2025-01-22T09:52:29Z")

</div>

```auto
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!

---

<div class="post-metadata">

### Author: ![castorp](https://www.pg-forum.de/letter_avatar_proxy/v4/letter/c/e99b99/32.png) [@castorp](https://www.pg-forum.de/u/castorp)
#### Post date: [22. Januar 2025 um 12:01 UTC](https://www.pg-forum.de/t/error-match-in-pg-typeof/13108/3 "2025-01-22T12:01:05Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![system](https://www.pg-forum.de/uploads/default/original/1X/dc97a981dd26692d5fb52e8b8fc7c090d7b9559a.png) [@system](https://www.pg-forum.de/u/system)
#### Post date: [23. März 2025 um 12:01 UTC](https://www.pg-forum.de/t/error-match-in-pg-typeof/13108/4 "2025-03-23T12:01:25Z")

</div>

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