[ 
https://issues.apache.org/jira/browse/OODT-521?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13484443#comment-13484443
 ] 

Cameron Goodale commented on OODT-521:
--------------------------------------

Chris you are absolutely correct (as usual).  After I created this issue I 
started digging into the code and saw the *fieldIdStringFlag* boolean being set 
to True would enable the string conversion to happen.  The tough part of this 
is that when you mix the DataSourceCatalog with an XMLRepositoryManager is when 
this mismatch occurs.

Just so this issue isn't a complete waste I will fix my issue and write up the 
Config setup/steps to successfully run this type of configuration for 
FileManager.  When the write up is complete I will add back a link in the 
comments for this issue (in the hope that someone else will find this).
                
> 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.5
>
>
> 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 is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to