×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Problem with fetchrow_array returning list instead of array (PERL,POSTGRES)

Problem with fetchrow_array returning list instead of array (PERL,POSTGRES)

Problem with fetchrow_array returning list instead of array (PERL,POSTGRES)

(OP)
I am using code that works correctly when getting data from MSSQL, but does not work correctly when I get data from POSTGRES on a MAC.

I am running my code on the latest MAC OS X Yosemite.
PERL version 5.18
DBI version 1.631
DBD-Pg version 3.4.2
Postgres version 9.3.5

the line of code is:

while (@results = $sth->fetchrow_array) {

$results[0] should contain 'DOE' and $results[1] should contain 'JOHN' like it does for MSSQL

What I get instead for Postgres is $results[0] = '("DOE","JOHN")' and $results[1] contains nothing

Is there something special I need to do for Postgres?

Michael Libeson

RE: Problem with fetchrow_array returning list instead of array (PERL,POSTGRES)

(OP)
I figured it out. PostgreSQL can be so picky.

I modified my program to generate a SQL query based on a FUNCTION (Stored Procedure) in Postgres to call the routine in this format:

SELECT * FROM Function();

Instead of the one giving me a problem like:

SELECT Function();


The " * FROM " changed the result format for the fetchrow_array.

Michael Libeson

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close