Port Bug Report: libpq result->fsize returns -1 for type CHAR

From: Unprivileged user <nobody>
To: pgsql-ports(at)postgresql(dot)org
Subject: Port Bug Report: libpq result->fsize returns -1 for type CHAR
Date: 1999-06-17 13:59:49
Message-ID: 199906171359.JAA22675@hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-ports


============================================================================
POSTGRESQL BUG REPORT TEMPLATE
============================================================================

Your name : John Chmielewski
Your email address : jlc(at)looknsee(dot)net

Category : runtime: front-end: Perl
Severity : non-critical

Summary: libpq result->fsize returns -1 for type CHAR

System Configuration
--------------------
Operating System : Redhat Linux 6.0

PostgreSQL version : 6.4.2

Compiler used :

Hardware:
---------
2.2.5-15 #1 Mon Apr 19 22:21:09 EDT 1999 i586 unknown

Versions of other tools:
------------------------
perl-5.00503

--------------------------------------------------------------------------

Problem Description:
--------------------
The perl module, pgsql_perl5-1.8.1.tar.gz, always reports
a size of -1 for all CHAR types. It seems to be a problem
with libpq rather than the perl module.

--------------------------------------------------------------------------

Test Case:
----------
Here is a test table:
CREATE TABLE xxx (
tape INT,
movie char (40) NOT NULL,
rating varchar(5),
release char (4),
runtime int,
counter char
) \g

Here is a test program
#!/usr/bin/perl

use Getopt::Std;
use Pg;

$usage = "Usage: pgtest [-h server] database [table]\n";
getopts('h:') || die $usage;
($database = shift) || die $usage;
($table = shift) || ($table = "xxx");
($server = $opt_h) || ($server = "localhost");

$conn = Pg::connectdb("dbname=$database host=$server");
if ($conn->status)
{
print "Connect Failed: ", $conn->errorMessage;
die "\n";
}

# SQL command so PGresult structure is pupolated
$result = $conn->exec("select * from $table where tape = 1");
if (!$result)
{
print "Select Failed: ", $conn->errorMessage;
die "\n";
}

$numfields = $result->nfields;
for ($i = 0; $i < $numfields; $i++)
{
$name[$i] = $result->fname($i);
print $name[$i], "\t", $result->ftype($i), "\t",
$result->fsize($i), "\n";
}

Here is the results of running the test program
tape 23 4
movie 1042 -1
rating 1043 -1
release 1042 -1
runtime 23 4
counter 1042 -1

--------------------------------------------------------------------------

Solution:
---------

--------------------------------------------------------------------------

Browse pgsql-ports by date

  From Date Subject
Next Message Unprivileged user 1999-06-17 16:01:08 Port Bug Report: buf_init.c does not compile (spin lock problem?)
Previous Message The Hermit Hacker 1999-06-17 12:23:34 Re: [HACKERS] Postgres mailing lists