使用此問題中提供的解決方案Select datatype of the field in postgres我能夠從我的表中查詢列的資料型別但是我在同一列上得到兩個不同的結果
SELECT column_name, data_type FROM information_schema.columns WHERE
table_name = 'mytable' AND column_name = 'timestamp';
RESULTS
-------
column_name|data_type |
-----------|------------------------|
timestamp |timestamp with time zone|
timestamp |character varying |
我如何確定哪個是該列的正確資料型別。它是一個char...或time...資料型別。
uj5u.com熱心網友回復:
也許您在兩個不同的模式中有兩個同名的表。
請像這樣更改您的查詢并添加table_schema:
SELECT table_schema, column_name, data_type FROM information_schema.columns WHERE
table_name = 'mytable' AND column_name = 'timestamp';
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/348647.html
標籤:sql PostgreSQL
