К основному контенту

Получение типа колонки в запросе


with t1 as (
select
100::int2 as col1,
200::int4 as col2,
'c'::char as col3,
'text1'::varchar(100) as col4,
'text2'::text as col5
)
select
col1, pg_typeof(col1),
col2, pg_typeof(col2),
col3, pg_typeof(col3),
col4, pg_typeof(col4),
col5, pg_typeof(col5)
from t1

Комментарии

Популярные сообщения из этого блога

Repeat Linux command every x seconds

watch -n 5 "ps -ef | grep COPY" watch -n 10 "psql -U postgres -c \"select clock_timestamp() - query_start as duration, substr(query,1,50) from pg_stat_activity where pid <> pg_backend_pid() and state='active' order by 1 desc\"" for i in {1..10}; do ps -ef | grep COPY; date ; sleep 5; done while true; do ps -ef | grep COPY ; date ; sleep 5; done