[ https://issues.apache.org/jira/browse/CONNECTORS-1642?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17105367#comment-17105367 ]
Karl Wright commented on CONNECTORS-1642: ----------------------------------------- The full code of the current method is the following: {code} /** Get a table's schema. *@param tableName is the name of the table. *@param cacheKeys are the keys against which to cache the query, or null. *@param queryClass is the name of the query class, or null. *@return a map of column names and ColumnDescription objects, describing the schema, or null if the * table doesn't exist. */ @Override public Map<String,ColumnDescription> getTableSchema(String tableName, StringSet cacheKeys, String queryClass) throws ManifoldCFException { StringBuilder query = new StringBuilder(); List list = new ArrayList(); query.append("SELECT pg_attribute.attname AS \"Field\","); query.append("CASE pg_type.typname WHEN 'int2' THEN 'smallint' WHEN 'int4' THEN 'int'"); query.append(" WHEN 'int8' THEN 'bigint' WHEN 'varchar' THEN 'varchar(' || pg_attribute.atttypmod-4 || ')'"); query.append(" WHEN 'text' THEN 'longtext'"); query.append(" WHEN 'bpchar' THEN 'char(' || pg_attribute.atttypmod-4 || ')'"); query.append(" ELSE pg_type.typname END AS \"Type\","); query.append("CASE WHEN pg_attribute.attnotnull THEN '' ELSE 'YES' END AS \"Null\","); query.append("CASE pg_type.typname WHEN 'varchar' THEN substring(pg_attrdef.adsrc from '^(.*).*$') ELSE pg_attrdef.adsrc END AS Default "); query.append("FROM pg_class INNER JOIN pg_attribute ON (pg_class.oid=pg_attribute.attrelid) INNER JOIN pg_type ON (pg_attribute.atttypid=pg_type.oid) "); query.append("LEFT JOIN pg_attrdef ON (pg_class.oid=pg_attrdef.adrelid AND pg_attribute.attnum=pg_attrdef.adnum) "); query.append("WHERE pg_class.relname=? AND pg_attribute.attnum>=1 AND NOT pg_attribute.attisdropped "); query.append("ORDER BY pg_attribute.attnum"); list.add(tableName); IResultSet set = performQuery(query.toString(),list,cacheKeys,queryClass); if (set.getRowCount() == 0) return null; // Digest the result Map<String,ColumnDescription> rval = new HashMap<String,ColumnDescription>(); int i = 0; while (i < set.getRowCount()) { IResultRow row = set.getRow(i++); String fieldName = row.getValue("Field").toString(); String type = row.getValue("Type").toString(); boolean isNull = row.getValue("Null").toString().equals("YES"); boolean isPrimaryKey = false; // row.getValue("Key").toString().equals("PRI"); rval.put(fieldName,new ColumnDescription(type,isPrimaryKey,isNull,null,null,false)); } return rval; } {code} The query I got from StackOverflow or the Postgresql manual (can't remember which) a decade ago. I think just replacing the query with a more modern version would work but I have no idea what the more modern version would be. Patches welcome. > PostgreSQL Version >= 12.2 DB Initialization Problems > ----------------------------------------------------- > > Key: CONNECTORS-1642 > URL: https://issues.apache.org/jira/browse/CONNECTORS-1642 > Project: ManifoldCF > Issue Type: Bug > Components: Framework core > Affects Versions: ManifoldCF 2.15 > Reporter: Uwe Wolfinger > Assignee: Karl Wright > Priority: Major > > when trying to run the "./executecommand.sh > org.apache.manifoldcf.crawler.InitializeAndRegister" script, the following > erro shows up and the initialization process stops: > {{ WARNING: Illegal reflective access by org.postgresql.jdbc.TimestampUtils > ([file:/home/suche/crawler/lib/postgresql-42.1.3.jar|file:///home/suche/crawler/lib/postgresql-42.1.3.jar]) > to field java.util.TimeZone.defaultTimeZone}} > {{ WARNING: Please consider reporting this to the maintainers of > org.postgresql.jdbc.TimestampUtils}} > {{ WARNING: Use --illegal-access=warn to enable warnings of further illegal > reflective access operations}} > {{ WARNING: All illegal access operations will be denied in a future release}} > {{ org.apache.manifoldcf.core.interfaces.ManifoldCFException: Database > exception: SQLException doing query (42703): FEHLER: Spalte pg_attrdef.adsrc > existiert nicht}} > {{ Position: 447}} > {{ at > org.apache.manifoldcf.core.database.Database$ExecuteQueryThread.finishUp(Database.java:715)}} > {{ at > org.apache.manifoldcf.core.database.Database.executeViaThread(Database.java:741)}} > {{ at > org.apache.manifoldcf.core.database.Database.executeUncachedQuery(Database.java:803)}} > {{ at > org.apache.manifoldcf.core.database.Database$QueryCacheExecutor.create(Database.java:1457)}} > {{ at > org.apache.manifoldcf.core.cachemanager.CacheManager.findObjectsAndExecute(CacheManager.java:146)}} > {{ at > org.apache.manifoldcf.core.database.Database.executeQuery(Database.java:204)}} > {{ at > org.apache.manifoldcf.core.database.DBInterfacePostgreSQL.performQuery(DBInterfacePostgreSQL.java:837)}} > {{ at > org.apache.manifoldcf.core.database.DBInterfacePostgreSQL.getTableSchema(DBInterfacePostgreSQL.java:696)}} > {{ at > org.apache.manifoldcf.core.database.BaseTable.getTableSchema(BaseTable.java:185)}} > {{ at > org.apache.manifoldcf.agents.agentmanager.AgentManager.install(AgentManager.java:67)}} > {{ at > org.apache.manifoldcf.agents.system.ManifoldCF.installTables(ManifoldCF.java:112)}} > > the column "pg_attrdef.adsrc" no longer exists in PostgreSQL DB 12.2. > [https://www.postgresql.org/docs/11/catalog-pg-attrdef.html] > which means that it is impossible to initialize the core DB in a PostgreSQL > 12.2 -- This message was sent by Atlassian Jira (v8.3.4#803005)