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

use quote_identifiers for problematic column names #8

Merged
merged 2 commits into from
Dec 8, 2015

Conversation

hatorikibble
Copy link
Contributor

this is a proposed fix for https://rt.cpan.org/Public/Bug/Display.html?id=108017, $dbh->quote_identifiers() should take care of 'bad' column and table names. Unfortunately I don't have a Postgres-Database available so I created just a general testcase at https://gist.github.com/hatorikibble/6b3d937cd447f617f9a0

@@ -1402,7 +1402,13 @@ sub populate {
$self->msg("- updating sequence $sequence");
$rs->result_source->storage->dbh_do(sub {
my ($storage, $dbh, @cols) = @_;
$self->msg(my $sql = "SELECT setval('${sequence}', (SELECT max($column) FROM ${table}));");
$self->msg(
my $sql = "SELECT setval('${sequence}', (SELECT max("
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sequence name needs to be quoted (or even better, passed in via a placeholder) too.

@hatorikibble
Copy link
Contributor Author

Thanks that's a good point, $sequence is now pulled in via bind_param

@dbsrgits-sync dbsrgits-sync merged commit b788f24 into dbsrgits:master Dec 8, 2015
@samuelckaufman
Copy link
Contributor

merged, thanks!

@hatorikibble hatorikibble deleted the bugreport_108017 branch January 2, 2016 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants