From: | Peter Mount <petermount(at)it(dot)maidstone(dot)gov(dot)uk> |
---|---|
To: | Chris Bitmead <chris(dot)bitmead(at)bigfoot(dot)com>, pgsql-hackers(at)postgresql(dot)org |
Subject: | RE: [HACKERS] Large objects error - expected a 'V' from the backe nd |
Date: | 1999-03-30 08:53:19 |
Message-ID: | A9DCBD548069D211924000C00D001C441B378C@exchange.maidstone.gov.uk |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
I'd advise you get 6.4.2 or better still wait until 6.5 is out.
When working on large object support for JDBC (at the time I was using
6.3.x) I came across this. The problem is caused by the order that libpq
expects the packets from the backend, and if memory serves (which it
isn't at the moment) a patch was submitted for it.
Peter
--
Peter T Mount, IT Section
petermount(at)it(dot)maidstone(dot)gov(dot)uk
Anything I write here are my own views, and cannot be taken as the
official words of Maidstone Borough Council
-----Original Message-----
From: Chris Bitmead [mailto:chris(dot)bitmead(at)bigfoot(dot)com]
Sent: Monday, March 29, 1999 11:58 AM
To: pgsql-hackers(at)postgreSQL(dot)org
Subject: [HACKERS] Large objects error - expected a 'V' from the backend
Hi all,
I'm using postgres 6.3.2 as built by RedHat 5.2.
Every time one of my programs tries to read the _2nd_ large object it
gets an error. Well actually, closing the descriptor on the 1st large
object fails as does retrieving the 2nd large object. The error is....
PQfn: expected a 'V' from the backend. Got 'N' instead
I have got a code extract below. It is simply a perl program using
Pg-0.91 that opens the database and tries to read two large objects
given on the command line.
What is the best bet for getting around this? Is upgrading to a later
version of postgres likely to help? Has anyone seen this before?
The large objects I'm using aren't very large. Only a few hundred bytes.
Are large objects well supported? Are they considered very stable to
use?
Here is the code....
package techmod;
require Exporter;
use DBI;
use Pg;
sub pgdbconnect
{
$pgdbh ||= Pg::connectdb("dbname=httpd");
die unless $pgdbh;
$pgdbh->trace(STDOUT);
return $pgdbh;
}
sub getlarge
{
my ($name,$lobjId)=(at)_;
my $buf;
my $mode = PGRES_INV_READ;
if (0 <= ($lobj_fd = $pgdbh->lo_open($lobjId, $mode)))
{
print "open\n";
while (0 < ($nbytes = $pgdbh->lo_read($lobj_fd, $b, 100000)))
{
$buf = $buf . $b;
}
if ($nbytes < 0)
{ print "read fail\n", $pgdbh->errorMessage; }
if ($pgdbh->lo_close($lobj_fd) < 0)
{ print "close fail\n", $pgdbh->errorMessage; }
}
else
{
print "notopen $lobjId\n", $pgdbh->errorMessage;
}
return $buf;
}
#!/usr/bin/perl
use techmod;
techmod->pgdbconnect();
$lobjId=$ARGV[0];
print techmod->getlarge($lobjId);
print techmod->getlarge($ARGV[1]);
Here is an extract from the trace.
To backend> F
To backend (4#)> 954
To backend (4#)> 2
To backend (4#)> 4
To backend (4#)> 0
To backend (4#)> 4
To backend (4#)> 100000
>From backend> V
>From backend> G
>From backend (#4)> 33
>From backend (33)> This is some data stored in a large object.
>From backend> 0
To backend> F
To backend (4#)> 954
To backend (4#)> 2
To backend (4#)> 4
To backend (4#)> 0
To backend (4#)> 4
To backend (4#)> 100000
>From backend> V
>From backend> G
>From backend (#4)> 0
>From backend (0)>
>From backend> 0
To backend> F
To backend (4#)> 953
To backend (4#)> 1
To backend (4#)> 4
To backend (4#)> 0
>From backend> N
close fail
PQfn: expected a 'V' from the backend. Got 'N' insteadThis is some data
stored in a large object
To backend> F
To backend (4#)> 952
To backend (4#)> 2
To backend (4#)> 4
To backend (4#)> 21008
To backend (4#)> 4
To backend (4#)> 262144
>From backend> N
notopen 21008
PQfn: expected a 'V' from the backend. Got 'N' instead
--
Chris Bitmead
http://www.bigfoot.com/~chris.bitmead
mailto:chris(dot)bitmead(at)bigfoot(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Mount | 1999-03-30 08:55:17 | Contacting me |
Previous Message | Chris Bitmead | 1999-03-30 08:30:18 | Regression failures |