develooper Front page | perl.dbd.pg | Postings from October 2011

Re: Quoting of values in arrays in broken in DBD::Pg, can you help fix it? ( CPAN RT#58552 ) [SumsaultRT #9386]

Thread Previous | Thread Next
From:
Tim Landscheidt
Date:
October 7, 2011 13:59
Subject:
Re: Quoting of values in arrays in broken in DBD::Pg, can you help fix it? ( CPAN RT#58552 ) [SumsaultRT #9386]
Message ID:
m3d3e8cybs.fsf@passepartout.tim-landscheidt.de
mark@summersault.com (Mark Stosberg) wrote:

> If you use DBD::Pg and also use PostgreSQL arrays, you should be aware
> there is an open bug with quoting PostgreSQL array values. A bug report
> about the issue is here, including some related test cases and work on
> some patches:

> https://rt.cpan.org/Public/Bug/Display.html?id=58552

> However, the proposed fix is not passing all the test cases. The
> solution will need someone with XS skills, who also has confidence about
> exactly what the correct quoting behavior should be.

> I'm affected by the issue and would personally appreciate the help.

First, I wholeheartedly agree that Noah's patch should fi-
nally be integrated. It's always a pleasure to see when
someone presents a working solution to a real problem, and
very sad if that is then shelved for now over a year :-(.

  But I cannot reproduce your problem with 2.17.1 + Noah's
patch:

| print Dumper $DB->selectall_arrayref ("SELECT s, LENGTH(s) FROM unnest(" . $DB->quote (["ab'c"]) . "::TEXT[]) AS s (s);", {});
| print Dumper $DB->selectall_arrayref ("SELECT s, LENGTH(s) FROM unnest(?::TEXT[]) AS s (s);", {}, ["ab'c"]);

gives the expected:

| $VAR1 = [
|           [
|             'ab\'c',
|             4
|           ]
|         ];
| $VAR1 = [
|           [
|             'ab\'c',
|             4
|           ]
|         ];

Tim

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About