[HACKERS] Error log for psql (uploading backup) in PostgreSQL 9.3.17 - Mailing list pgsql-hackers

From Nick Dro
Subject [HACKERS] Error log for psql (uploading backup) in PostgreSQL 9.3.17
Date
Msg-id ~002592591F44E40D300B181@walla.co.il
Whole thread Raw
Responses Re: [HACKERS] Error log for psql (uploading backup) in PostgreSQL 9.3.17  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
Hi,
I should say that I'm haviing this issue since 9.3.2 I though it would be resolved when I upgrade to 9.3.17 but this still appear.
This is a very wierd issue.
 
I upload backups using pg_restore and
psql -h SERVER -U USERNAME -f backup.sql -q -d databasename -pPORT 2>errors.txt >output.txt
 
When I open the errors.txt file I see:
 
psql:backup.sql:43112523: ERROR:  relation "tablename" does not exist
LINE 3: from tablename
             ^
QUERY: 
select tablenameid
from tablename
join tablename_visable v using(statusid)
where id=$1
order by id,case statusidwhen 2 then 1 when 1 then 2 else 3 end, coalesce(rev,'-1') desc
limit 1
 
 
Now, the intresting thing is that tablename exists in the backup.
I can do:
select * from tablename
The table is OK, the data is OK. So I don't understand this error.
 
It looks like a wrong order of commands, maybe the creation of the table is done after it creates this code?
 
Why is this happens?

pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: [HACKERS] Index created in BEFORE trigger not updated duringINSERT
Next
From: Robert Haas
Date:
Subject: Re: [HACKERS] [BUGS] Concurrent ALTER SEQUENCE RESTART Regression