Обсуждение: Pg (Perl for Postgresql)
Does this belong on this list?
Using Pg, it seems I get an error when trying to query a 7.3 database:
$fromconn = Pg::connectdb( "host=testhost port=5439 dbname=test-73"
); die $fromconn->errorMessage unless ($fromconn->status eq PGRES_CONNECTION_OK);
$query = "select x, y from table1;";
$result = $fromconn->exec( $query );
$status = $result->resultStatus;
if ( $status ne PGRES_TUPLES_OK ) { print "query failed: "; print $status; print "\n$query\n"; print "\n";
}
returns:
query failed: 7
select x, y from table1;
Is there a newer version of Pg that should be used that can read both 7.2
and 7.3 databases?
Thanks,
--
Laurette Cisneros
The Database Group
(510) 420-3137
NextBus Information Systems, Inc.
www.nextbus.com
----------------------------------
Life is an SQL old chum...
Laurette Cisneros <laurette@nextbus.com> writes:
> Is there a newer version of Pg that should be used that can read both 7.2
> and 7.3 databases?
I suspect this failure has nothing to do with Pg itself. I suggest
printing out the query error message, rather than guessing about the
problem ...
regards, tom lane
Ok, I see the problem... The column and the table are named the same: select x, y from y; In 7.3 it gives the error message: ERROR: You can't use relation names alone in the target list, try relation.*. It works fine in 7.2 Laurette (not guessing) On Thu, 19 Dec 2002, Tom Lane wrote: > Laurette Cisneros <laurette@nextbus.com> writes: > > Is there a newer version of Pg that should be used that can read both 7.2 > > and 7.3 databases? > > I suspect this failure has nothing to do with Pg itself. I suggest > printing out the query error message, rather than guessing about the > problem ... > > regards, tom lane > -- Laurette Cisneros The Database Group (510) 420-3137 NextBus Information Systems, Inc. www.nextbus.com ---------------------------------- Life is an SQL old chum...
Laurette Cisneros <laurette@nextbus.com> writes:
> The column and the table are named the same:
> select x, y from y;
> In 7.3 it gives the error message:
> ERROR: You can't use relation names alone in the target list, try relation.*.
> It works fine in 7.2
Hm, there must be more to it than meets the eye, because that condition
alone doesn't cause a problem:
regression=# create table y (x int, y int);
CREATE TABLE
regression=# select x, y from y;x | y
---+---
(0 rows)
How did you declare the table, exactly?
regards, tom lane