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


Your name : John Chmielewski
Your email address : jlc@looknsee.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:
---------


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

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppgsql-ports @
categoriespostgresql
postedJun 17, '99 at 1:59p
activeJun 17, '99 at 1:59p
posts1
users1
websitepostgresql.org
irc#postgresql

1 user in discussion

John Chmielewski: 1 post

People

Translate

site design / logo © 2022 Grokbase