lundi 26 janvier 2015

PostgreSQL determine column type when data_type is set to ARRAY


I came across an oddity where PostgreSQL sets the data_type to ARRAY in the information_schema.columns table. I did the following query to gain some insight:



SELECT * FROM information_schema.columns
WHERE table_schema NOT IN ('pg_catalog', 'information_schema')
AND table_name='__table_name__';


I noticed the udt_name column and am wondering if it is a reliable way to determine what type of array the column's data is?



SELECT column_name, data_type, udt_name FROM information_schema.columns
WHERE table_schema NOT IN ('pg_catalog', 'information_schema')
AND table_name='__table_name__';




Aucun commentaire:

Enregistrer un commentaire