Is it possible to get the field type from a MySQL query, in the same way you can get it from a table with the
SHOW COLUMNS command? Such as from a derived table,
SELECT x -- presumedMetaFn(x) -- returns "int" FROM ( SELECT 1 AS x UNION SELECT 2 ) AS t;
Given the above query, is there a function or something that I can use to get the type of x? PostgreSQL makes this available with the System Information Functions
SELECT x, pg_typeof(x) FROM ( VALUES (1),(2) ) AS t(x); x | pg_typeof ---+----------- 1 | integer 2 | integer (2 rows)
I am not looking for metadata on a table, but from the result of query. With
psql on PostgreSQL 11+, this is also possible by running
\gdesc after the query.