zxs / tungsten-replicator

Automatically exported from code.google.com/p/tungsten-replicator
0 stars 0 forks source link

MySQL to Redshit: unquoted table names #1057

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1.It seems like Redshfit Interprets timestamp column name as a key word. You 
can reproduce the issue by creating following table
2. CREATE TABLE sample_table (id INTEGER, timestamp DATETIME);
3. SELECT timestamp, id FROM sample_table;

...
What is the expected output?
 timestamp | id
-----------+----
(0 rows)

...
What do you see instead?
ERROR:  syntax error at or near ","
LINE 1: SELECT timestamp, id FROM sample_table;

...
What version of the product are you using?
tungsten-replicator-3.0.0-500.tar.gz

...
On what operating system?
Amazon Linux 2014.09

...
Please provide any additional information below.

Notes: Please take a look on google group discussion for more details
https://groups.google.com/forum/#!topic/tungsten-replicator-discuss/_ehrmy9g8uY
...

Original issue reported on code.google.com by serghey....@gmail.com on 7 Nov 2014 at 1:50

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
As a workaround I suggest 

+++ 
sources/replicator/src/java/com/continuent/tungsten/replicator/csv/CsvInfo.java 
2014-11-12 19:05:46.466093503 +0200
@@ -112,7 +112,7 @@
         {
             if (colNames.length() > 0)
                 colNames.append(",");
-            colNames.append(col.getName());
+            colNames.append("`"+col.getName()+"`");
         }
         return colNames.toString();
     }

Original comment by serghey....@gmail.com on 12 Nov 2014 at 5:06

GoogleCodeExporter commented 9 years ago
This issue was updated by revision r2686.

CONT-35
Adding support for keywords used as database object names

e.g. in redshift :
CREATE TABLE employees_prod.sample_table
(
   id         integer      NOT NULL,
   "timestamp"  timestamp
)

Original comment by stephane...@continuent.com on 28 Nov 2014 at 2:23

GoogleCodeExporter commented 9 years ago

Original comment by stephane...@continuent.com on 28 Nov 2014 at 5:01

GoogleCodeExporter commented 9 years ago
Verified with build 3.0.1-58. Passed.

Original comment by csaba.si...@continuent.com on 15 Dec 2014 at 8:11

GoogleCodeExporter commented 9 years ago

Original comment by linas.vi...@continuent.com on 20 Jan 2015 at 9:39

GoogleCodeExporter commented 9 years ago

Original comment by linas.vi...@continuent.com on 20 Jan 2015 at 9:41