[ 
https://issues.apache.org/jira/browse/OODT-521?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Chris A. Mattmann resolved OODT-521.
------------------------------------
    Resolution: Not a Problem

the fix is described herein and had to do more with the underlying databases 
and some settings for them. Thanks Cam great back and forth!

> ExpImpCatalog Tool doesn't wrap product_type_id in single quotes
> ----------------------------------------------------------------
>
>                 Key: OODT-521
>                 URL: https://issues.apache.org/jira/browse/OODT-521
>             Project: OODT
>          Issue Type: Bug
>          Components: file manager
>    Affects Versions: 0.4
>         Environment: centOS
>            Reporter: Cameron Goodale
>            Assignee: Cameron Goodale
>            Priority: Minor
>             Fix For: 0.9
>
>
> When using the ExpImpCatalog tool to migrate from a Lucene based catalog into 
> a PostgreSQL catalog I encountered the following error:
> {code}
> INFO: Cataloging Product: [MOD09GA.A2012297.h09v04.005.NRT.hdf]
> Oct 25, 2012 10:48:16 AM 
> org.apache.oodt.cas.filemgr.catalog.DataSourceCatalog addProduct
> FINE: addProduct: Executing: INSERT INTO products (product_name, 
> product_structure, product_transfer_status, product_type_id) VALUES 
> ('MOD09GA.A2012297.h09v04.005.NRT.hdf', 'Flat', 'RECEIVED', 
> urn:snow:MOD09GANRT)
> org.postgresql.util.PSQLException: ERROR: syntax error at or near ":"
>   Position: 168
>         at 
> org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2157)
>         at 
> org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1886)
>         at 
> org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)
>         at 
> org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:555)
>         at 
> org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:403)
> {code}
> So I looked into the source code at:
> https://svn.apache.org/repos/asf/oodt/trunk/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/DataSourceCatalog.java
> And on line 243:
> {code:title=DataSourceCatalog.java|borderStyle=solid}
>             addProductSql = "INSERT INTO products (product_name, 
> product_structure, product_transfer_status, product_type_id) "
>                     + "VALUES ('"
>                     + product.getProductName()
>                     + "', '"
>                     + product.getProductStructure()
>                     + "', '"
>                     + product.getTransferStatus()
>                     + "', "
>                     + productTypeIdStr
>                     + ")";
> {code}
> The other values are wrapped in single quotes.  I think if I also wrap the 
> last element in single quotes this Error should be resolved.
> I will test this against my current migration task and post a patch.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to