Re: Suspected bug: outer WHERE reordered before inner WHERE -> input syntax ERROR

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: John Keith Hohm <john(at)hohm(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Suspected bug: outer WHERE reordered before inner WHERE -> input syntax ERROR
Date: 2008-09-08 17:09:01
Message-ID: 20080908170901.GF4411@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

John Keith Hohm wrote:

> select * from (
> select * from (VALUES ('100'), ('JOHN')) as A (n)
> where trim(trim(n), '0123456789') = ''
> ) as B where n::integer <> -1;

> I'm also interested in responses of the form "why not just do X?".

Why not just add an "OFFSET 0" in the subselect so that the optimizer
does not flatten the query?

select * from (
select * from (VALUES ('100'), ('JOHN')) as A (n)
where trim(trim(n), '0123456789') = ''
offset 0) as B where n::integer <> -1;

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message justin 2008-09-08 17:32:55 Automated Backup On Windows
Previous Message John Keith Hohm 2008-09-08 17:05:00 Suspected bug: outer WHERE reordered before inner WHERE -> input syntax ERROR