@Override public boolean haveMinimumServerVersion(Version ver) { return haveMinimumServerVersion(ver.getVersionNum()); }
/** * Take the a String representing an array of ACLs and return a Map mapping the SQL permission * name to a List of usernames who have that permission. * For instance: {@code SELECT -> user1 -> list of [grantor, grantable]} * * @param aclArray ACL array * @param owner owner * @return a Map mapping the SQL permission name */ public Map<String, Map<String, List<String[]>>> parseACL(String aclArray, String owner) { if (aclArray == null) { // arwdxt -- 8.2 Removed the separate RULE permission // arwdDxt -- 8.4 Added a separate TRUNCATE permission String perms = connection.haveMinimumServerVersion(ServerVersion.v8_4) ? "arwdDxt" : "arwdxt"; aclArray = "{" + owner + "=" + perms + "/" + owner + "}"; } List<String> acls = parseACLArray(aclArray); Map<String, Map<String, List<String[]>>> privileges = new HashMap<String, Map<String, List<String[]>>>(); for (String acl : acls) { addACLPrivileges(acl, privileges); } return privileges; }
boolean pgFuncResultExists = connection.haveMinimumServerVersion(ServerVersion.v8_4);
if (connection.haveMinimumServerVersion(ServerVersion.v8_3)) { sql = "SELECT NULL AS TABLE_CAT, n.nspname AS TABLE_SCHEM, " + " ct.relname AS TABLE_NAME, NOT i.indisunique AS NON_UNIQUE, " + " (i.keys).n AS ORDINAL_POSITION, " + " trim(both '\"' from pg_catalog.pg_get_indexdef(ci.oid, (i.keys).n, false)) AS COLUMN_NAME, " + (connection.haveMinimumServerVersion(ServerVersion.v9_6) ? " CASE am.amname " + " WHEN 'btree' THEN CASE i.indoption[(i.keys).n - 1] & 1 "
if (!connection.haveMinimumServerVersion(ServerVersion.v9_0)) { sql += ", pg_catalog.pg_depend dep "; + " AND fkn.oid = fkc.relnamespace AND fkc.oid = fka.attrelid AND fka.attnum = con.conkey[pos.n] AND con.conrelid = fkc.oid " + " AND con.contype = 'f' AND pkic.relkind = 'i' "; if (!connection.haveMinimumServerVersion(ServerVersion.v9_0)) { sql += " AND con.oid = dep.objid AND pkic.oid = dep.refobjid AND dep.classid = 'pg_constraint'::regclass::oid AND dep.refclassid = 'pg_class'::regclass::oid "; } else {
if (haveMinimumServerVersion(ServerVersion.v9_0) && "ApplicationName".equals(name)) { if (value == null) { value = "";
+ (connection.haveMinimumServerVersion(ServerVersion.v8_4) ? "a.attacl, " : "") + " a.attname " + " FROM pg_catalog.pg_namespace n, pg_catalog.pg_class c, " if (connection.haveMinimumServerVersion(ServerVersion.v8_4)) { String acl = rs.getString("attacl"); Map<String, Map<String, List<String[]>>> relPermissions = parseACL(acl, owner);
@Override public ResultSet getClientInfoProperties() throws SQLException { Field[] f = new Field[4]; f[0] = new Field("NAME", Oid.VARCHAR); f[1] = new Field("MAX_LEN", Oid.INT4); f[2] = new Field("DEFAULT_VALUE", Oid.VARCHAR); f[3] = new Field("DESCRIPTION", Oid.VARCHAR); List<byte[][]> v = new ArrayList<byte[][]>(); if (connection.haveMinimumServerVersion(ServerVersion.v9_0)) { byte[][] tuple = new byte[4][]; tuple[0] = connection.encodeString("ApplicationName"); tuple[1] = connection.encodeString(Integer.toString(getMaxNameLength())); tuple[2] = connection.encodeString(""); tuple[3] = connection .encodeString("The name of the application currently utilizing the connection."); v.add(tuple); } return ((BaseStatement) createMetaDataStatement()).createDriverResultSet(f, v); }
connection.checkClosed(); if (keywords == null) { if (connection.haveMinimumServerVersion(ServerVersion.v9_0)) {
if (connection.haveMinimumServerVersion(ServerVersion.v8_4)) { sql = "SELECT * FROM ("; } else { + "OR (t.typtype = 'd' AND t.typnotnull) AS attnotnull,a.atttypmod,a.attlen,"; if (connection.haveMinimumServerVersion(ServerVersion.v8_4)) { sql += "row_number() OVER (PARTITION BY a.attrelid ORDER BY a.attnum) AS attnum, "; } else { if (connection.haveMinimumServerVersion(ServerVersion.v10)) { sql += "nullif(a.attidentity, '') as attidentity,"; } else { sql += " AND c.relname LIKE " + escapeQuotes(tableNamePattern); if (connection.haveMinimumServerVersion(ServerVersion.v8_4)) { sql += ") c WHERE true ";
if (LOGGER.isLoggable(Level.WARNING) && !haveMinimumServerVersion(ServerVersion.v8_2)) { LOGGER.log(Level.WARNING, "Unsupported Server Version: {0}", queryExecutor.getServerVersion()); if (haveMinimumServerVersion(ServerVersion.v8_3)) { _typeCache.addCoreType("uuid", Oid.UUID, Types.OTHER, "java.util.UUID", Oid.UUID_ARRAY); _typeCache.addCoreType("xml", Oid.XML, Types.SQLXML, "java.sql.SQLXML", Oid.XML_ARRAY); if (haveMinimumServerVersion(ServerVersion.v9_0)) { String appName = PGProperty.APPLICATION_NAME.get(info); if (appName == null) {