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

Fix ordering in column list query of PostgreSQL connector

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.4.6
    • 1.4.7
    • None
    • None

    Description

      PostgreSQL connector gets the lit of column names from pg_attribute system catalog table using the following query:

      SELECT col.ATTNAME FROM PG_CATALOG.PG_NAMESPACE sch,  PG_CATALOG.PG_CLASS tab, PG_CATALOG.PG_ATTRIBUTE col
      WHERE sch.OID = tab.RELNAMESPACE   AND tab.OID = col.ATTRELID   AND sch.NSPNAME = (SELECT CURRENT_SCHEMA())  AND tab.RELNAME = ?   AND col.ATTNUM >= 1  AND col.ATTISDROPPED = 'f'
      

      This SELECT statement does not contain an ORDER BY clause so the order of the result set is not guaranteed to be the column order defined during table creation and this can cause issues for the users.
      The task is to make sure that the result set of this query is sorted by the attnum column of the pg_attribute table (https://wiki.postgresql.org/wiki/Alter_column_position).

      Attachments

        1. SQOOP-3124.patch
          0.6 kB
          Vasas Szabolcs

        Issue Links

          Activity

            People

              vasas Vasas Szabolcs
              vasas Vasas Szabolcs
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: