acl = rs.getString("relacl"); permissions = parseACL(acl, owner);
acls = (String[])rs.getObject("relacl"); permissions = parseACL(acls, owner);
	public java.sql.ResultSet getTablePrivileges(String catalog,		String schemaPattern, String tableNamePattern) throws SQLException	{		ResultSetField f[] = new ResultSetField[7];		ArrayList v = new ArrayList();		f[0] = new ResultSetField("TABLE_CAT", TypeOid.VARCHAR,			getMaxNameLength());		f[1] = new ResultSetField("TABLE_SCHEM", TypeOid.VARCHAR,			getMaxNameLength());		f[2] = new ResultSetField("TABLE_NAME", TypeOid.VARCHAR,			getMaxNameLength());		f[3] = new ResultSetField("GRANTOR", TypeOid.VARCHAR,			getMaxNameLength());		f[4] = new ResultSetField("GRANTEE", TypeOid.VARCHAR,			getMaxNameLength());		f[5] = new ResultSetField("PRIVILEGE", TypeOid.VARCHAR,			getMaxNameLength());		f[6] = new ResultSetField("IS_GRANTABLE", TypeOid.VARCHAR,			getMaxNameLength());		String sql = "SELECT n.nspname,c.relname,u.usename,c.relacl "				+ " FROM pg_catalog.pg_namespace n, pg_catalog.pg_class c, pg_catalog.pg_user u "				+ " WHERE c.relnamespace = n.oid "				+ " AND u.usesysid = c.relowner " + " AND c.relkind = 'r' "                + " AND " + resolveSchemaPatternCondition(                                "n.nspname", schemaPattern);		if(tableNamePattern != null && !"".equals(tableNamePattern))		{			sql += " AND c.relname LIKE '" + escapeQuotes(tableNamePattern)				+ "' ";		}		sql += " ORDER BY nspname, relname ";		ResultSet rs = m_connection.createStatement().executeQuery(sql);		String schema = null;		String table = null;		String owner = null;		String acl = null;		HashMap permissions = null;		String permNames[] = null;		while(rs.next())		{			schema = rs.getString("nspname");			table = rs.getString("relname");			owner = rs.getString("usename");			acl = rs.getString("relacl");			permissions = parseACL(acl, owner);			permNames = (String[])permissions.keySet().toArray(new String[permissions.size()]);			sortStringArray(permNames);			for(int i = 0; i < permNames.length; i++)			{				ArrayList grantees = (ArrayList)permissions.get(permNames[i]);				for(int j = 0; j < grantees.size(); j++)				{					String grantee = (String)grantees.get(j);					String grantable = owner.equals(grantee) ? "YES" : "NO";					Object[] tuple = new Object[7];					tuple[0] = null;					tuple[1] = schema;					tuple[2] = table;					tuple[3] = owner;					tuple[4] = grantee;					tuple[5] = permNames[i];					tuple[6] = grantable;					v.add(tuple);				}			}		}		rs.close();		return createSyntheticResultSet(f, v);	}