Skip Menu |
 
rt.cpan.org will be shut down on March 1st, 2021.

This queue is for tickets about the DBD-Pg CPAN distribution.

Report information
The Basics
Id: 93636
Status: rejected
Priority: 0/
Queue: DBD-Pg

People
Owner: greg [...] turnstep.com
Requestors: dbdpg [...] galatali.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in:
  • 2.99.9_2
  • 3.0.0
Fixed in: (no value)



Subject: Dollar Quoting is being triggered in the middle of a identifier
MIME-Version: 1.0
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
Message-ID: <rt-4.0.18-22732-1394231375-984.0-0-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 442
Download (untitled) / with headers
text/plain 442b
An identifier containing a pair of dollar signs triggers the dollar quote handling in pg_st_split_statement, which can consume the rest of the SQL statement and trigger a secondary error of no placeholders being found. Example: $dbh->do('SELECT tablename AS alt$identifier$test FROM pg_tables WHERE tablename = ?', { }, ''); Error: DBD::Pg::db do failed: called with 1 bind variables when 0 are needed at dbq.pl line 5. Tugrul Galatali
MIME-Version: 1.0
In-Reply-To: <rt-4.0.18-22732-1394231375-984.0-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
References: <rt-4.0.18-22732-1394231375-984.0-0-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="utf-8"
Message-ID: <rt-4.0.18-28747-1394245698-211.93636-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 84
Ugh, why would you ever want to create a name like that? :) We will look into this.
MIME-Version: 1.0
In-Reply-To: <rt-4.0.18-28747-1394245698-211.93636-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
References: <rt-4.0.18-22732-1394231375-984.0-0-0 [...] rt.cpan.org> <rt-4.0.18-28747-1394245698-211.93636-0-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="utf-8"
Message-ID: <rt-4.0.18-25123-1394245853-829.93636-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 267
Download (untitled) / with headers
text/plain 267b
Off the top of my head, I can't see us adding a whole lot more parsing brains into DBD::Pg when there is an easy workaround - putting the name in double quotes: $dbh->do(q{SELECT tablename AS "alt$identifier$test" FROM pg_tables WHERE tablename = ?}, { }, 'foobar');
MIME-Version: 1.0
In-Reply-To: <rt-4.0.18-25123-1394245853-829.93636-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: API
References: <rt-4.0.18-22732-1394231375-984.0-0-0 [...] rt.cpan.org> <rt-4.0.18-28747-1394245698-211.93636-0-0 [...] rt.cpan.org> <rt-4.0.18-25123-1394245853-829.93636-0-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="utf-8"
Message-ID: <rt-4.0.18-23003-1394251315-1735.0-0-0 [...] rt.cpan.org>
Message-ID: <rt-4.0.18-23003-1394251315-354.93636-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 253
Download (untitled) / with headers
text/plain 253b
Fair enough. However it would be nice if there was a more appropriate error. I didn't even know about dollar quoting until I went digging into the DBD::Pg code. Maybe a warning if the closing dollar quote isn't found? Also a note in the documentation.
MIME-Version: 1.0
In-Reply-To: <rt-4.0.18-23003-1394251315-1735.0-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
References: <rt-4.0.18-22732-1394231375-984.0-0-0 [...] rt.cpan.org> <rt-4.0.18-28747-1394245698-211.93636-0-0 [...] rt.cpan.org> <rt-4.0.18-25123-1394245853-829.93636-0-0 [...] rt.cpan.org> <rt-4.0.18-23003-1394251315-1735.0-0-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="utf-8"
Message-ID: <rt-4.0.18-15237-1396476880-804.93636-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 365
Download (untitled) / with headers
text/plain 365b
Show quoted text
> Maybe a warning if the closing dollar quote isn't found? Also a note > in the documentation.
No, because it could still be a valid query if the closing dollar isn't found. The idea is to pass things off to the Postgres parser and let them throw the error. It's unfortunate that happens on first execute and not prepare, but I don't see a clean way around that.
MIME-Version: 1.0
In-Reply-To: <rt-4.0.18-15237-1396476880-804.93636-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
References: <rt-4.0.18-22732-1394231375-984.0-0-0 [...] rt.cpan.org> <rt-4.0.18-28747-1394245698-211.93636-0-0 [...] rt.cpan.org> <rt-4.0.18-25123-1394245853-829.93636-0-0 [...] rt.cpan.org> <rt-4.0.18-23003-1394251315-1735.0-0-0 [...] rt.cpan.org> <rt-4.0.18-15237-1396476880-804.93636-0-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="utf-8"
Message-ID: <rt-4.0.18-10469-1400666681-1628.93636-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 17
Stalling for now
MIME-Version: 1.0
In-Reply-To: <rt-4.0.18-10469-1400666681-1628.93636-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
References: <rt-4.0.18-22732-1394231375-984.0-0-0 [...] rt.cpan.org> <rt-4.0.18-28747-1394245698-211.93636-0-0 [...] rt.cpan.org> <rt-4.0.18-25123-1394245853-829.93636-0-0 [...] rt.cpan.org> <rt-4.0.18-23003-1394251315-1735.0-0-0 [...] rt.cpan.org> <rt-4.0.18-15237-1396476880-804.93636-0-0 [...] rt.cpan.org> <rt-4.0.18-10469-1400666681-1628.93636-0-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="utf-8"
Message-ID: <rt-4.0.18-10322-1418985977-272.93636-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 146
Download (untitled) / with headers
text/plain 146b
Statements that might contain unusual identifiers should be constructed using the quote_identifier method. I think this issue could be closed now.
MIME-Version: 1.0
In-Reply-To: <rt-4.0.18-10322-1418985977-272.93636-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
References: <rt-4.0.18-22732-1394231375-984.0-0-0 [...] rt.cpan.org> <rt-4.0.18-28747-1394245698-211.93636-0-0 [...] rt.cpan.org> <rt-4.0.18-25123-1394245853-829.93636-0-0 [...] rt.cpan.org> <rt-4.0.18-23003-1394251315-1735.0-0-0 [...] rt.cpan.org> <rt-4.0.18-15237-1396476880-804.93636-0-0 [...] rt.cpan.org> <rt-4.0.18-10469-1400666681-1628.93636-0-0 [...] rt.cpan.org> <rt-4.0.18-10322-1418985977-272.93636-0-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="utf-8"
Message-ID: <rt-4.0.18-24930-1491178125-516.93636-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 14
Closing this.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.