Stephan Szabo <sszabo@xxxxxxxxxxxxxxxxxxxxx> writes: > It looks like the problem is that relkind is of the somewhat odd > PostgreSQL type "char" not an actual char(1), so with the else in there it > appears to try to force the unknown literals into that type which only > takes the first character. It will probably work if you cast in the else, > like "else CAST(c.relkind as CHAR(1))". Right, the problem is that all the string literals are "unknown" and don't force a type decision, so the "char" type gets chosen as the result type of the CASE, and then the literals get coerced to that. If you explicitly cast any one of the CASE output expressions to text --- either relkind, or any of the constants --- the behavior is as the OP expects. regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 2: Don't 'kill -9' the postmaster