How do I execute \d tablename
using Java and PostgreSQL?
PreparedStatement pst = jdbc.conn.prepareStatement("\d u_item");
ResultSet set = pst.executeQuery();
Error:
org.postgresql.util.PSQLException: ERROR: syntax error at or near "\"
How do I execute \d tablename
using Java and PostgreSQL?
PreparedStatement pst = jdbc.conn.prepareStatement("\d u_item");
ResultSet set = pst.executeQuery();
Error:
org.postgresql.util.PSQLException: ERROR: syntax error at or near "\"
\d
is a command of the interactive psql
client. It is not part of SQL.
You can't execute this command over a JDBC connection.
You can also obtain table meta data Using Postgres java driver.
String tableName = "u_item";
ResultSet rs = metaData.getColumns(null, null, tableName.toLowerCase(), null))
Table name is converted to lowercase when Postgres stores its name in the system catalog.
[updated] have you checked this