Skip to content

fixes ISSUE-46847: PG SCRAM authentication issue in jdbc

Asier Lostalé requested to merge alo-issues/openbravo:fix/46847-pgjdbc into master

Updates PostrgreSQL JDBC driver: 42.2.16 -> 42.2.20 (latest as of today), which includes the fix for SCRAM authentication.

Tests

  • try: https://builds.openbravo.com/job/try-init/850/console (false positive)
  • dbsm test suite
  • PG jdbc 42.2.20, includes a fix (PgDatabaseMetaData should return column names as described in specification) that @huehner raised a concern about potentially causing incompatibilities. DBSM tests didn't raise any problem. The change looks quite safe: what is changed from lower to upper case is not the result of getMetaData().getTables() but the names of the columns getMetaData().getColumnName(i). Also note ResultSet.getString(columnLabel) is case insensitive (ie. rs.getString('table_name') would work both with old and new driver. The only way to fail I see is to rely in the exact name as returned, which is very unlikely (ie. if (rsmd.getColumnName(i).equals("TABLE_NAME")) as mentioned here).

The following code:

      ResultSet rs = OBDal.getInstance()
          .getConnection()
          .getMetaData()
          .getTables(null, null, null, null);

      for (var i = 1; i <= rs.getMetaData().getColumnCount(); i += 1) {
        System.out.print(rs.getMetaData().getColumnName(i) + "\t");
      }
      System.out.println();

      for (var r = 0; r < 5; r++) {
        rs.next();
        
        for (var i = 1; i <= rs.getMetaData().getColumnCount(); i += 1) {
          System.out.print(rs.getString(i) + "\t");
        }
        System.out.println();
      }

Outputs with new driver:

TABLE_CAT	TABLE_SCHEM	TABLE_NAME	TABLE_TYPE	REMARKS	TYPE_CAT	TYPE_SCHEM	TYPE_NAME	SELF_REFERENCING_COL_NAME	REF_GENERATION	
null	public	a_amortization_key	INDEX	null						
null	public	a_amortization_posted	INDEX	null						
null	public	a_amortizationline_amortiz_idx	INDEX	null						
null	public	a_amortizationline_asset_idx	INDEX	null						
null	public	a_amortizationline_key	INDEX	null	

And with old one:

table_cat	table_schem	table_name	table_type	remarks	type_cat	type_schem	type_name	self_referencing_col_name	ref_generation	
null	public	a_amortization_key	INDEX	null						
null	public	a_amortization_posted	INDEX	null						
null	public	a_amortizationline_amortiz_idx	INDEX	null						
null	public	a_amortizationline_asset_idx	INDEX	null						
null	public	a_amortizationline_key	INDEX	null	

Related MRs

Edited by Asier Lostalé

Merge request reports