Thread: Obscure bug

Obscure bug

From
"Andrew Brown"
Date:
Here is an obscure bug I encountered.

Note, this was running on:
RedHat 6.2 (standard)
DBD-Pg-0.93
postgresql-7.0.2

All built using gcc 2.95.2


Using the attached test program to insert into a table with the following
definition:
expr_id    int4         not null
line_no    int4         not null
line_text  varchar(254)

The output is as follows:
perl t2 x
2: ERROR:  Unterminated quoted string

---------

Andrew Brown            E-Mail: mailto:andrew_brown@adc.com
Senior Systems Engineer Phone:  +61 7 4928 1020
ADC/Saville Systems     Fax:    +61 7 4928 1082
                        Web:    http://www.adc.com

Re: Obscure bug

From
Tom Lane
Date:
"Andrew Brown" <andrew_brown@adc.com> writes:
> Using the attached test program to insert into a table with the following
> definition:
> expr_id    int4         not null
> line_no    int4         not null
> line_text  varchar(254)

> The output is as follows:
> perl t2 x
> 2: ERROR:  Unterminated quoted string

I cannot reproduce this failure here, using current sources and
DBD-Pg-0.93.  Possibly it's a bug that's been fixed since 7.0.*
but I don't recall having heard of any quoting-related fixes.
Please investigate more closely.

One thing you should at least do is narrow down whether the problem
is in DBD or the backend.  If you start perl with environment variable
PGOPTIONS=-d2 to log received queries, what do you get in the postmaster
log?  I see

DEBUG:  StartTransactionCommand
DEBUG:  query: begin
DEBUG:  ProcessUtility: begin
DEBUG:  CommitTransactionCommand
DEBUG:  StartTransactionCommand
DEBUG:  query: delete from expression_line where EXPR_ID = 40000
DEBUG:  ProcessQuery
DEBUG:  CommitTransactionCommand
DEBUG:  StartTransactionCommand
DEBUG:  query: commit
DEBUG:  ProcessUtility: commit
DEBUG:  CommitTransactionCommand
DEBUG:  StartTransactionCommand
DEBUG:  query: begin
DEBUG:  ProcessUtility: begin
DEBUG:  CommitTransactionCommand
DEBUG:  StartTransactionCommand
DEBUG:  query: insert into expression_line (EXPR_ID,LINE_NO,LINE_TEXT) values (40000,1,'                        / \\')
DEBUG:  ProcessQuery
DEBUG:  CommitTransactionCommand
DEBUG:  StartTransactionCommand
DEBUG:  query: insert into expression_line (EXPR_ID,LINE_NO,LINE_TEXT) values (40000,2,'                     abc \\')
DEBUG:  ProcessQuery
DEBUG:  CommitTransactionCommand
DEBUG:  StartTransactionCommand
DEBUG:  query: commit
DEBUG:  ProcessUtility: commit
DEBUG:  CommitTransactionCommand

which looks reasonable enough ...

            regards, tom lane