dbsrgits/sql-translator — pull request #25 by kiwiroy (2012-12-18 23:56:42+00:00)
Title: Sql keyword field types

Running
```bash
sqlt -f DBI --dsn 'dbi:Pg:host=;dbname=' --db-user -t Dumper --producer-dsn 'dbi:Pg:host=;dbname=' --producer-db-user > dumper.pl

perl dumper.pl --no-comments --add-truncate > dbname.data.sql
```

results in
```plain
DBD::Pg::st execute failed: ERROR: syntax error at or near "desc"
LINE 1: select id, create_time, update_time, name, desc, form_values...
^ at dumper.pl line 1665.
DBD::Pg::st execute failed: ERROR: syntax error at or near "desc"
LINE 1: select id, create_time, update_time, name, desc, form_values...
^ at dumper.pl line 1665.
```

This is mainly due to columns named "desc" in tables. Quoting the column names in the SELECT statement cures this. Whether this is a fix for all database engines I'm not sure.

Additionally timestamp and bytea fields are output as data type numbers, but this fails on loading into MySQL.
```plain
ERROR 1064 (42000) at line 205: You have an error in your SQL syntax;
```

This patch fixes both of these "features".