Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sql keyword field types #25

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

kiwiroy
Copy link

@kiwiroy kiwiroy commented Dec 18, 2012

Running

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

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

results in

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.

ERROR 1064 (42000) at line 205: You have an error in your SQL syntax; 

This patch fixes both of these "features".

Review on Reviewable

…elect

Signed-off-by: Roy Storey <roy.storey@plantandfood.co.nz>
Signed-off-by: Roy Storey <roy.storey@plantandfood.co.nz>
@ribasushi
Copy link
Contributor

Can I please have some t/66-postgres-dbi-parser.t tests with that? Thanks!

@frioux
Copy link
Member

frioux commented Oct 30, 2013

emailed author for tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants