Re: Problems with error "table does not exist"

From: Date: Thu, 28 Dec 2000 19:18:52 +0000
Subject: Re: Problems with error "table does not exist"
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-32128@lists.php.net to get a copy of this message
Nuno, I'm not familiar with Postgres, but a few things about DBI - first off you should read the DBI documentation by doing "perldoc DBI" - you'll find a lot of great info in there about using DBI. You should test *every* DBI statement(such as connect, prepare, execute, etc.) for errors - read the DBI perldocs with special attention to "RaiseError" and "PrintError". Also read the DBI perldocs on "trace". Nuno Medeiros [medeiros@publico.pt] wrote: > > The code is: > > #!/usr/bin/perl > use CGI; > use DBI; > $dbconn=DBI->connect("dbi:Pg:dbname=tabelas;port=5432;host=myhost","postgres One option for error reporting is to die if there's an error, like: $dbconn=DBI->connect("dbi:Pg:dbname=tabelas;port=5432;host=myhost","postgres","" ) || die "Can't connect"; > > $comm = "SELECT * from doc_html"; > > #$comm = "SELECT * from pg_database"; > > $result = $dbconn->prepare($comm) You could try DBI->trace(2) here for the prepare and execute, like this: DBI->trace(2); ### turn trace on $result = $dbconn->prepare($comm) || die "Can't prepare: $DBI::errstr"; $result->execute() || die "Can't execute: $DBI::errstr"; DBI->trace(0); ### turn trace off > $result->execute() > > .... > When i use the first $comm it doesn't work, but the second $comm works fine. > If i create the table in template1 database it works fine I don't know why the 1st one doesn't work - maybe there's a problem with the doc_html table. Try either RaiseError=1(read the perldocs) or die, and try the DBI->trace to help you find out if and where there's a problem. > > thanks for your time > > > -----Original Message----- > From: dbi-users-bounce@isc.org [mailto:dbi-users-bounce@isc.org]On > Behalf Of Hardy Merrill > Sent: quinta-feira, 28 de Dezembro de 2000 16:57 > To: Nuno Medeiros > Cc: Dbi-Users > Subject: Re: Problems with error "table does not exist" > > > > Be more specific - include the code that doesn't work. > > -- > Hardy Merrill > Mission Critical Linux, Inc. > http://www.missioncriticallinux.com > > Nuno Medeiros [medeiros@publico.pt] wrote: > > > > > > Hi, > > > > i'm new in postgres, and i have this problem: > > > > i have created a new database called "tabelas" with some tables in it. > > When i try to access my tables from DBI i have this message "Table does > not > > exist", but if i try to access a system table, it works. > > > > Can somebody help me? > > > > Thanks > > Nuno > > > > -------------------------------- > > publico.pt > > Nuno Medeiros > > nuno.medeiros@publico.pt > > > > > > > > > > -------------------------------------------------------------------------- > ---- > > DBI HOME PAGE AND ARCHIVES: > http://www.symbolstone.org/technology/perl/DBI/ > > To unsubscribe from this list, please visit: > http://www.isc.org/dbi-lists.html > > If you are without web access, or if you are having trouble with the web > page, > > please send mail to dbi-users-request@isc.org with the subject line of: > > 'unsubscribe'. > > -------------------------------------------------------------------------- > ---- > > > ---------------------------------------------------------------------------- > -- > DBI HOME PAGE AND ARCHIVES: > http://www.symbolstone.org/technology/perl/DBI/ > To unsubscribe from this list, please visit: > http://www.isc.org/dbi-lists.html > If you are without web access, or if you are having trouble with the web > page, > please send mail to dbi-users-request@isc.org with the subject line of: > 'unsubscribe'. > ---------------------------------------------------------------------------- > -- > -- Hardy Merrill Mission Critical Linux, Inc. http://www.missioncriticallinux.com

« previous php.general (#32128) next »