@Override
	public String getSource(String catalog, String schema, String entry) {
		String res = super.getSource(catalog, schema, entry);
		if (res != null  &&  res.length() > 0) {
			return res;
		}

		String query =
			"SELECT ordinal_position, column_name, data_type, udt_name," +
			"       is_nullable, character_maximum_length, numeric_precision " +
			"  FROM information_schema.columns " +
            " WHERE table_catalog = '" + catalog + "' " +
            "   AND table_schema = '" + schema + "' " +
			"   AND table_name = '" + entry + "' " +
			" ORDER BY ordinal_position ";

		List<String[]> rows = runQuery(query);
		StringBuffer scriptSB = new StringBuffer(44 * rows.size());
		scriptSB.append("CREATE TABLE " + qualifiedName(schema, entry) + " (\n");
		writeColumnDef(rows, scriptSB);

		// Add the PRIMARY KEY constraints, if any -- the results of the query
		// to get constraints will consist of the constraint name, table name,
		// constraint type and the fully-formed constraint definition
		boolean first = true;
		rows = getConstraints(catalog, schema, entry);
		for (String[] row : rows) {
		    if ("PRIMARY KEY".equals(row[2])) {
                scriptSB.append(",");
                if (first) {
                    first = false;
                    scriptSB.append("\n");
                }
		        scriptSB.append("\n   CONSTRAINT ").append(row[0]);
                scriptSB.append(" ").append(row[3]);
		    }
		}

        // Add the FOREIGN KEY, CHECK, UNIQUE constraints, if any
        for (String[] row : rows) {
            if (! "PRIMARY KEY".equals(row[2])) {
                scriptSB.append(",");
                if (first) {
                    first = false;
                    scriptSB.append("\n");
                }
                scriptSB.append("\n   CONSTRAINT ").append(row[0]);
                String constraintDef = row[3];
                if (constraintDef.contains("::character varying")) {
                    constraintDef = constraintDef.replaceAll("::text", "");
                    constraintDef = constraintDef.replaceAll("::character varying", "");
                    constraintDef = constraintDef.replaceAll("\\= ANY \\(ARRAY\\[", "IN (");
                    constraintDef = constraintDef.replaceAll("\\]\\[\\]", "");
                }
                scriptSB.append(" ").append(constraintDef);
            }
        }
		scriptSB.append("\n);\n");

		return scriptSB.toString();
	}