niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » Programming » Perl » modules
Help with DBD::Pg
Post new topic   Reply to topic Page 1 of 1 [2 Posts] View previous topic :: View next topic
Author Message
Terrence Brannon
*nix forums beginner


Joined: 23 Feb 2005
Posts: 33

PostPosted: Wed Feb 23, 2005 6:12 pm    Post subject: Re: Help with DBD::Pg Reply with quote

Santinho <ms@simplicidade.com> writes:

Quote:
Greetings,

I wrote a Perl program wich uses PostgreSQL. This program was running well for
months until yesterday, when my SysAdmin upgraded the DBD:Razzg module for the
current version (1.40).

Now, where I have

my $sql = "
LOCK TABLE tabreserves IN SHARE MODE;
SELECT
tabreserves.date,
tabreserves.hour_i,
tabreserves.hour_e,
tabreserves.idreserve,
tabreserves.fk_idfield,
tabfields.imped,
tabfields.design

FROM tabreserves
LEFT JOIN tabfields ON
tabfields.idfield = tabreserves.fk_idfield
WHERE date = ? AND (hour_i < ? AND hour_e > ?)
AND (fk_idfield = ? OR ? = ANY (imped))
LIMIT 1


DBD:Razzg::st execute failed: ERROR: column "hour_i" is of type integer
+ but expression is of type character varying
HINT: You will need to rewrite or cast the expression.

#postgresql on irc.freenode.net IRC or the postgres mailing lists
#might be the best resource for hit

Quote:

Needless to say that I have _many_ statements wich uses the same structure -
e.g. multiple commands in a prepared statement

Your multiple commands look like two commands, one of which should've
been abstracted into a function called lock_prepare, e,g,L

my $sth = lock_prep($sql);
$sth->execute;

where locK_prep is

sub lock_prep {
my($table,$sql) = @_;

$dbh->do("LOCK TABLE $table IN SHARE MODE");
$dbh->prepare($sql);

}


Quote:

What am I missing here? Do I really need to cast expressions? and why can't I
use multiple statements now?

Try your SQL from the command-line. It will stil have the type
errors. Then ask on a postgres newgroup as your problem is more
postgres than perl.

--
Carter's Compass: I know I'm on the right track when,
by deleting something, I'm adding functionality.
Back to top
Santinho
*nix forums beginner


Joined: 23 Feb 2005
Posts: 2

PostPosted: Wed Feb 23, 2005 4:17 pm    Post subject: Help with DBD::Pg Reply with quote

Greetings,

I wrote a Perl program wich uses PostgreSQL. This program was running well for
months until yesterday, when my SysAdmin upgraded the DBD:Razzg module for the
current version (1.40).

Now, where I have

my $sql = "
LOCK TABLE tabreserves IN SHARE MODE;
SELECT
tabreserves.date,
tabreserves.hour_i,
tabreserves.hour_e,
tabreserves.idreserve,
tabreserves.fk_idfield,
tabfields.imped,
tabfields.design

FROM tabreserves
LEFT JOIN tabfields ON
tabfields.idfield = tabreserves.fk_idfield
WHERE date = ? AND (hour_i < ? AND hour_e > ?)
AND (fk_idfield = ? OR ? = ANY (imped))
LIMIT 1
";

Raises 2 errors:

1st

DBD:Razzg::st execute failed: ERROR: cannot insert multiple commands in
+to a prepared statement

If I delete the first line LOCK TABLE tabreserves IN SHARE MODE;, raises another
error.

2nd

DBD:Razzg::st execute failed: ERROR: column "hour_i" is of type integer
+ but expression is of type character varying
HINT: You will need to rewrite or cast the expression.

Needless to say that I have _many_ statements wich uses the same structure -
e.g. multiple commands in a prepared statement and not casting expressions,
since that wasn't mandatory before.

When we (me and the sysadmin) saw the errors we thought: "well... time to
upgrade to PostgreSQL 8!". We were using 7.4. We did the upgrade. But the errors
persist.

What am I missing here? Do I really need to cast expressions? and why can't I
use multiple statements now?

Thanks,
Miguel
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [2 Posts] View previous topic :: View next topic
The time now is Wed Jan 07, 2009 7:21 pm | All times are GMT
navigation Forum index » Programming » Perl » modules
Jump to:  


Mbna | Watch Anime Free Online | Mobile Phones | Mobile Phones | Myspace Images
Copyright © 2004-2005 DeniX Solutions SRL
 
Other DeniX Solutions sites: Unix/Linux blog |  electronics forum |  medicine forum |  science forum | 
Privacy Policy


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1045s ][ Queries: 15 (0.0294s) ][ GZIP on - Debug on ]