开发者

Can I get types from an arbitrary query in Postrges?

开发者 https://www.devze.com 2023-04-07 23:58 出处:网络
I\'ve got a situation building a data analysis tool where my users can write SQL query (including joins, calculations, etc) and I need to be provide options to the user based on the data types of the

I've got a situation building a data analysis tool where my users can write SQL query (including joins, calculations, etc) and I need to be provide options to the user based on the data types of the columns in the result. I'm us开发者_如何学Going JDBC to connect to Postgres. Is there any way to get Postgres to report the data type of a computed column?


With JDBC, you should be able to call .getMetaData() in your ResultSet, and iterate through the columns and e.g. learn their types with .getColumnType()

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号