I'm not familiar with DBD::Pg, so I'm not positive that it supports placeholders, but if it does you should use them - they will handle all your quoting for you, and make your code *MUCH* cleaner. Read up on using placeholders by doing "perldoc DBI" at the *nix prompt, or in a windoze DOS prompt window at the DOS prompt.
HTH. -- Hardy Merrill Mission Critical Linux, Inc. http://www.missioncriticallinux.com Warren Volz [[EMAIL PROTECTED]] wrote: > I was wondering if anyone had suggestions about the following problem > I am having with DBD::Pg. A script I have is trying to insert the > following statement into a mail table (schema below): > > INSERT INTO mail (server_message_num, instance, subject, on_disk, > date, message_id, valid, size, owner, from_addr) VALUES (25, 1, 'RE: > ~{'',''b''`''S''n~} ~{''Y''Q~} ~{''\\''b''`''S''n~}!', 'f', 'Mon Sep > 10 10:45:48 2001', '[EMAIL PROTECTED]', 't', 5314, 2667, > 'Yelena Dandurov > a') > > The schema for the table looks like: > > CREATE TABLE mail ( > message_id CHAR(150) NOT NULL, > server_message_num INTEGER, > instance INTEGER, > valid BOOL NOT NULL DEFAULT false,--info valid > on_disk BOOL NOT NULL DEFAULT false, > decoded_mime BOOL NOT NULL DEFAULT false, > owner INTEGER NOT NULL REFERENCES sis_user > (sis_user_id), > last_checked TIMESTAMP NOT NULL DEFAULT TEXT 'now', > status SMALLINT NOT NULL DEFAULT 0,--read/unread etc > size INTEGER, > from_addr VARCHAR(80), > date TIMESTAMP, > subject VARCHAR(100), > PRIMARY KEY (message_id, owner, instance) > ); > > Notice the subject which is RE: and a bunch of characters. We use the > quote function to escape the subject, and the insert statement works > fine using the PostgreSQL monitor, but DBD::Pg can't insert it. The > error in the postgres error log is: > > Sep 26 16:52:33 xxxxx postgres[8884]: [3] ERROR: Bad timestamp > external representation 'Mon Sep 10 10NULLNULL 2001' > > I can remove the subject and the insert goes fine... I have a feeling > the driver is having trouble passing the quoted string to the > backend. Any ideas/suggestions? > > Thanks, > Warren