Code Monkey home page Code Monkey logo

Comments (7)

turnstep avatar turnstep commented on August 21, 2024 1

Not sure this is a bug - last_insert() should be passed the literal table name, not a doubled-up double quote version. I put a new test for that in t/03smethod.t - please take a look at that if you can.

5f83ebf

from dbdpg.

jboakye avatar jboakye commented on August 21, 2024

perl: 5.26.1, Postgresql 13, latest version of DBD Pg

from dbdpg.

jboakye avatar jboakye commented on August 21, 2024

Maybe In Pg.pm?:
my $table_for_query = $table;
$table_for_query =~ s/["]{2}/"/g;
my @Args = ($table_for_query);

from dbdpg.

jboakye avatar jboakye commented on August 21, 2024

I made the change to my local copy of Pg.pm and that seems to have fixed it:

---snip
my $query_table = $table;
$query_table =~ s/["]{2}/"/g;
my @Args = ($query_table);
my $schemawhere;
if (length $schema) {
# if given a schema, use that
$schemawhere = 'n.nspname = ?';
push @Args, $schema;
} else {
# otherwise it must be visible via the search path
$schemawhere = 'pg_catalog.pg_table_is_visible(c.oid)'

-- snip

from dbdpg.

jboakye avatar jboakye commented on August 21, 2024

diff --git a/Pg.pm b/Pg.pm
index 2839aab..80ae1c1 100644
--- a/Pg.pm
+++ b/Pg.pm
@@ -351,7 +351,10 @@ use 5.008001;
$dbh->set_err(1, 'last_insert_id needs at least a sequence or table name');
return undef;
}

  •        my @args = ($table);
    
  •        #if table includes double quotes, it would be paired up at this point. we want to unpair it.
    
  •        my $table_for_query = $table;
    
  •        $table_for_query =~  s/["]{2}/"/g;
    
  •        my @args = ($table_for_query);
           my $schemawhere;
           if (length $schema) {
               # if given a schema, use that
    

I have a fix ready to go if I am able to open a pull request, I appreciate all of your work and I know you are busy. If I could get some sort of response that would be great as my current project is stalled. Thank you all so much.

from dbdpg.

esabol avatar esabol commented on August 21, 2024

@jboakye : Your diff here was completely mangled because it wasn't inside triple backticks (```). I recommend opening a PR. I think the maintainer(s) would be able to evaluate your solution best that way.

from dbdpg.

turnstep avatar turnstep commented on August 21, 2024

Closing this for now

from dbdpg.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.