Re: Correct pg_type for a list of columns with SELECT?

dome stuff <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.dbi.general
Message-ID <CA+tv+i=2g-zP_anb5rZL-fzwss+q5qQgBgbf8UNL7_EyXSDCdg@mail.gmail.com>
Thanks John,

I was able to come up with something that works about the same (though a
little clunky) by passing column names to the fetchall_arrayref function.
Should someone search out this email in the future, the solution was to
wildcard the SELECT statement and use the following feature as documented
in DBI:

#### From the DBI pod:

To fetch only the fields called "foo" and "bar" of every row as a hash ref
(with keys named "foo" and "BAR", regardless of the original
capitalization):

  $tbl_ary_ref = $sth->fetchall_arrayref({ foo=>1, BAR=>1 });

####

Thanks again!


On Sun, Nov 24, 2013 at 1:57 PM, John R Pierce <[email protected]> wrote:

> On 11/24/2013 10:05 AM, dome stuff wrote:
>
>>
>> $1 contains a comma delimited list of column names.
>>
>> I can run the query on the CLI and it works. If I swap the question mark
>> that is $1 in the query, with a static column list, the query works in
>> perl. Presumably I should be able to pass a column list as a variable when
>> preparing a statement, but apparently I'm not getting the type correct?
>>
>
> You are not supposed to be able to do that in SQL.   parameters can only
> be used for data values, not field names or other statement components.
>
> --
> john r pierce                                      37N 122W
> somewhere on the middle of the left coast
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.