"benj.dev" <benj.dev@laposte.net> writes:
> I Have a request that produce a bad result. I'm able to rewrite this
> request in a form that always produce a good result.
It's not at all clear from the amount of info provided whether you've
hit a Postgres bug or are just misunderstanding the semantics of your
query. However ...
> The version of Postgres is "PostgreSQL 9.3.6 on x86
> 64-unknown-linux-gnu, compiled by gcc (Ubuntu 4.8.2-19Ubuntu1) 4.8.2,
> 64-bit"
... that's a rather old version of Postgres; we released 9.3.19 yesterday.
And a quick perusal of the 9.3-branch commit log finds quite a few
LATERAL-related bug fixes that went in since 9.3.6. You might consider
updating to 9.3.something-recent and see if anything changes.
regards, tom lane