public static boolean hasColumn(final CConnection connection,final String tableName,final String columnName){
  Preconditions.checkNotNull(columnName,"IE02035: Column name argument can not be null");
  Preconditions.checkNotNull(tableName,"IE02036: Table name argument can not be null");
  Preconditions.checkNotNull(connection,"IE02037: Connection argument can not be null");
  final String query=String.format("SELECT attname FROM pg_attribute WHERE attrelid = " + " (SELECT oid FROM pg_class WHERE relname = '%s') AND attname = '%s';",tableName,columnName);
  try (ResultSet result=connection.executeQuery(query,true)){
    return result.first();
  }
 catch (  final SQLException e) {
    return false;
  }
}

public static boolean hasColumn ( final CConnection connection , final String tableName , final String columnName ) { Preconditions . checkNotNull ( columnName , "IE02035: Column name argument can not be null" ) ; Preconditions . checkNotNull ( tableName , "IE02036: Table name argument can not be null" ) ; Preconditions . checkNotNull ( connection , "IE02037: Connection argument can not be null" ) ; final String query = String . format ( "SELECT attname FROM pg_attribute WHERE attrelid = " + " (SELECT oid FROM pg_class WHERE relname = '%s') AND attname = '%s';" , tableName , columnName ) ; try ( ResultSet result = connection . executeQuery ( query , true ) ) { return result . first ( ) ; } catch ( final SQLException e ) { return false ; } }
determines whether a column with a given name is present in a given table .
