Uploaded image for project: 'Sqoop'
  1. Sqoop
  2. SQOOP-2302

Wrong order of fields

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 1.4.7
    • Fix Version/s: None
    • Component/s: connectors/postgresql
    • Labels:
      None

      Description

      org.apache.sqoop.manager.PostgresqlManager#getListColumnsQuery misses ORDER BY clause.

      Imports from PostgreSQL can be damaged.

      A patch to fix:

      diff --git a/src/java/org/apache/sqoop/manager/PostgresqlManager.java b/src/java/org/apache/sqoop/manager/PostgresqlManager.java
      old mode 100644
      new mode 100755
      index bd882b9..03245cb
      --- a/src/java/org/apache/sqoop/manager/PostgresqlManager.java
      +++ b/src/java/org/apache/sqoop/manager/PostgresqlManager.java
      @@ -155,7 +155,8 @@ protected String getListColumnsQuery(String tableName) {
           + "  AND sch.NSPNAME = " + getSchemaSqlFragment()
           + "  AND tab.RELNAME = '" + escapeLiteral(tableName) + "' "
           + "  AND col.ATTNUM >= 1"
      -    + "  AND col.ATTISDROPPED = 'f'";
      +    + "  AND col.ATTISDROPPED = 'f' "
      +    + "ORDER BY col.ATTNAME";
         }
      
         @Override
      @@ -170,7 +171,8 @@ protected String getPrimaryKeyQuery(String tableName) {
           + "  AND sch.NSPNAME = " + getSchemaSqlFragment()
           + "  AND tab.RELNAME = '" + escapeLiteral(tableName) + "' "
           + "  AND col.ATTNUM = ANY(ind.INDKEY) "
      -    + "  AND ind.INDISPRIMARY";
      +    + "  AND ind.INDISPRIMARY "
      +    + "ORDER BY col.ATTNAME";
         }
      
         private String getSchemaSqlFragment() {
      
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              knivit knivit
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: