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

Wrong order of fields

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.4.7
    • None
    • connectors/postgresql
    • 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

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

            Dates

              Created:
              Updated: