sqoop-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Cheolsoo Park" <cheol...@cloudera.com>
Subject Review Request: SQOOP-445 Wrong query for getListColumnsQuery in PostgresqlManager
Date Tue, 17 Apr 2012 06:12:11 GMT

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/4752/
-----------------------------------------------------------

Review request for Sqoop.


Summary
-------

When querying for column available in a postgres table from postgres catalog, it returns also
the dropped columns from the table in object. It can be easily fixed adding the extra constraint
"AND col.ATTISDROPPED = 'f'" at the end of the query which sort out the dropped columns.


This addresses bug SQOOP-445.
    https://issues.apache.org/jira/browse/SQOOP-445


Diffs
-----

  /src/java/org/apache/sqoop/manager/PostgresqlManager.java 1326931 

Diff: https://reviews.apache.org/r/4752/diff


Testing
-------

ant test, ant test -Dthirdparty=true, ant checkstyle.

In addition, I manually tested the constraint "col.ATTISDROPPED = 'f'" as follows:


sqooptest=# create table foo (i integer);
CREATE TABLE

sqooptest=# alter table foo drop column i;
ALTER TABLE


<without col.ATTISDROPPED = 'f'>

sqooptest=# 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 = 'foo' AND col.ATTNUM >=
1;
           attname            
------------------------------
 ........pg.dropped.1........
(1 row)


<with col.ATTISDROPPED = 'f'>

sqooptest=# 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 = 'foo' AND col.ATTNUM >=
1  AND col.ATTISDROPPED = 'f';
 attname 
---------
(0 rows)


Thanks,

Cheolsoo


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message