Skip Menu |
 

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

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

People
Owner: Nobody in particular
Requestors: lembark [...] wrkhors.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



CC: lembark [...] wrkhors.com
MIME-Version: 1.0
X-Spam-Status: No, score=-2.969 tagged_above=-99.9 required=10 tests=[AWL=-1.070, BAYES_00=-1.9, WEIRD_QUOTING=0.001] autolearn=ham
X-Mailer: Claws Mail 3.12.0 (GTK+ 2.24.28; x86_64-pc-linux-gnu)
X-Spam-Flag: NO
content-type: text/plain; charset="utf-8"
Message-ID: <20150927181541.79a5440c [...] cannibal>
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
Organization: Workhorse Computing
X-Spam-Score: -2.969
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id 8AF662405B4 for <cpan-bug+DBD-Pg [...] hipster.bestpractical.com>; Sun, 27 Sep 2015 19:15:55 -0400 (EDT)
Received: from hipster.bestpractical.com ([127.0.0.1]) by localhost (hipster.bestpractical.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qtoY4OrrL9iz for <cpan-bug+DBD-Pg [...] hipster.bestpractical.com>; Sun, 27 Sep 2015 19:15:53 -0400 (EDT)
Received: from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by hipster.bestpractical.com (Postfix) with SMTP id 79A3B240389 for <bug-DBD-Pg [...] rt.cpan.org>; Sun, 27 Sep 2015 19:15:53 -0400 (EDT)
Received: (qmail 16749 invoked by alias); 27 Sep 2015 23:15:52 -0000
Received: from 68-188-122-34.static.stls.mo.charter.com (HELO duke.wrkhors.com) (68.188.122.34) by la.mx.develooper.com (qpsmtpd/0.28) with ESMTP; Sun, 27 Sep 2015 16:15:50 -0700
Received: from cannibal (cannibal [192.168.1.4]) by duke.wrkhors.com (Postfix) with ESMTP id A996D10EDE0; Sun, 27 Sep 2015 18:15:45 -0500 (CDT)
Delivered-To: cpan-bug+DBD-Pg [...] hipster.bestpractical.com
Subject: Fetchall arrayref of ( serial, jsonb ) query result gives text scalar '( id_value, "{jsonb contents}")' rather than array with two elements.
Return-Path: <lembark [...] wrkhors.com>
X-RT-Mail-Extension: dbd-pg
X-Original-To: cpan-bug+DBD-Pg [...] hipster.bestpractical.com
X-Spam-Check-BY: la.mx.develooper.com
Date: Sun, 27 Sep 2015 18:15:41 -0500
X-Spam-Level:
To: bug-DBD-Pg [...] rt.cpan.org
Content-Transfer-Encoding: 7bit
From: Steven Lembark <lembark [...] wrkhors.com>
X-RT-Original-Encoding: ascii
X-RT-Interface: Email
Content-Length: 2684
Download (untitled) / with headers
text/plain 2.6k
What seems odd is that I'm getting a single scalar that looks like JSON of the result rather than an arrayref with two elements. PG 9.4.4 (AWS RDS instance). Using DBD::Pg 3.5.1, Perl 5.22.0 (compiled locally). Setup: create table address ( address_id serial not null, name varchar(32) not null, data jsonb not null, primary key ( address_id ), unique ( name ) ); Prepare: select address, address_data from address where name = ? Instead of getting an arrayref with two elements I get a single element with the id and json as a list: 243: $dbh->prepare( $sql => $fixed_argz ) DB<2> p $sql select ( address_id, address ) from active_address where lookup = $1 DB<3> x $fixed_argz; 0 HASH(0x2e20810) 'pg_placeholder_dollaronly' => 1 'pg_placeholder_nocolons' => 1 eval { 'ARRAY' eq reftype $_[0] ? $sth->execute( @{ $_[0] } ) : $sth->execute( @_ ) }; croak "Failed execute_query: $@" if $@; $sth->{ Active } or return; my $flat = wantarray // do { $sth->finish; return; }; $flat ? @{ $sth->fetchall_arrayref } : $sth->fetchall_arrayref list context return from SoRipe::Util::Database::execute_query: 0 ARRAY(0x3cfe3e8) 0 '(7002,"{""zip"": ""63110-3704"", ""city"": ""St Louis"", ""state"": ""MO"", ""street"": ""3646 Flora Pl"", ""address"": ""3646 Flora Pl St Louis MO 63110-3704"", ""quality"": ""P1AAA"", ""is_valid"": 1, ""latitude"": 38.612407, ""longitude"": -90.242071, ""location_id"": 799}")' i.e., the single scalar: '(7002,"{""zip"": ""63110-3704"", ""city"": ""St Louis"", ""state"": ""MO"", ""street"": ""3646 Flora Pl"", ""address"": ""3646 Flora Pl St Louis MO 63110-3704"", ""quality"": ""P1AAA"", ""is_valid"": 1, ""latitude"": 38.612407, ""longitude"": -90.242071, ""location_id"": 799}")' rather than [ "7002", "{""zip"": ""63110-3704"", ""city"": ""St Louis"", ""state"": ""MO"", ""street"": ""3646 Flora Pl"", ""address"": ""3646 Flora Pl St Louis MO 63110-3704"", ""quality"": ""P1AAA"", ""is_valid"": 1, ""latitude"": 38.612407, ""longitude"": -90.242071, ""location_id"": 799}" ] Sorry if this is expected behavior, but I didn't see anything in the docs about special handling of jsonb data. thanks -- Steven Lembark 3646 Flora Pl Workhorse Computing St Louis, MO 63110 lembark@wrkhors.com +1 888 359 3508
MIME-Version: 1.0
In-Reply-To: <20150927181541.79a5440c [...] cannibal>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
References: <20150927181541.79a5440c [...] cannibal>
Content-Type: text/plain; charset="utf-8"
Message-ID: <rt-4.0.18-28418-1443730089-830.107371-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: 189
Download (untitled) / with headers
text/plain 189b
Via email, Steven tells me this was a misunderstanding on his part of the PostgreSQL `()` syntax. He plans to submit a Pod patch to help head off similar confusion for people in the future.


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.