Home > Net >  How to get data type column from sql query has casting
How to get data type column from sql query has casting

Time:09-17

How to get data type column from SQL query has casting or custom query, not from view or table like database client pgAdmin4 can detect type data on column from result query

pgadmin screenshoot

CodePudding user response:

Like mentioned in the comments, you can you use pg_typeof. Not sure if you added the picture after the comment, but you can also use this for your results as requested in the picture:

select pg_typeof(val1), pg_typeof(val2)
from (
    select 123 as val1, 123::text as val2 
 )z

Results:

|integer|text|
  • Related