Thread: Backend sent D message without prior T

Backend sent D message without prior T

From
Jeff Eckermann
Date:
My main server is down, so I am using my backup copy on a different
database.
Based on past posts I have read, this error is usually associated with
running out of memory for the query result.  Problem is, I am only
expecting about 30 lines of moderate length to be returned....  I see
nothing in the query which would produce unexpected results: unless my
beserk use of regular expressions has something to do with it?
Note the strange switch to "copy" mode following the error.
I would appreciate any suggestions.
PostgreSQL version 7.03 running on FreeBSD 4.0-RELEASE.
256M memory available...
TIA

extracts=# \o ls_dsl.txt
extracts=# select p.* from products p, customers c where p.arbor_acct_no =
c.external_id and p.product_description ~ '^VGS' or (p.product_description
~* 'dsl' and (c.rev_rcv_cost_ctr ~ '^180' or c.bill_state ~* '^la$'));
Backend sent D message without prior T
Enter data to be copied followed by a newline.
End with a backslash and a period on a line by itself.
>>
>> ^C
>> \.
Unknown protocol character 'l' read from backend.  (The protocol character
is the first character the backend sends in response to a query it
receives).
PQendcopy: resetting connection
extracts=#


Re: Backend sent D message without prior T

From
Tom Lane
Date:
Jeff Eckermann <jeff@akira.eckermann.com> writes:
> Based on past posts I have read, this error is usually associated with
> running out of memory for the query result.  Problem is, I am only
> expecting about 30 lines of moderate length to be returned....

Have you verified that by doing
    select count(*) from ... where ...
Watching psql's memory usage with top(1) is another way to check whether
a memory overrun might be happening.

The 'D message without prior T' followed by unexpected switch into COPY
mode certainly suggests that libpq has lost sync with the backend's
output.  I am not aware of any failure modes that cause that in 7.0.3,
other than the aforementioned out-of-memory problem.

            regards, tom lane