Stephen Frost <sfrost@snowman.net> writes:
> * Stephen Frost (sfrost@snowman.net) wrote:
>>> Is this a regression versus earlier releases, or just a bad thing in general?
>> It's really a regression- in prior releases
> Sorry, to clarify (after reading through my -hackers inbox a bit more
> and realizing you were probably asking about 9.2)- it's a regression,
> but it was also in earlier releases.. I'd have to go back to the git
> blame that I ran earlier to find it, but I think the change was made
> in 8.4 or 9.0, so I don't think it's a regression as far as
> 9.0 -> 9.1 or 9.1 -> 9.2 is concerned.
> I'm slightly ashamed to admit that we discovered it during our migration
> from 8.2 -> 9.1...
Um ... I don't see any difference in the clause ordering from 8.2
forward. "SELECT * FROM baz<TAB>" produces a query like this in 8.2:
LOG: statement: SELECT pg_catalog.quote_ident(c.relname) FROM pg_catalog.pg_class c WHERE c.relkind IN ('r', 'S', 'v')
ANDsubstring(pg_catalog.quote_ident(c.relname),1,3)='baz' AND pg_catalog.pg_table_is_visible(c.oid) AND c.relnamespace
<>(SELECT oid FROM pg_catalog.pg_namespace WHERE nspname = 'pg_catalog')UNIONSELECT pg_catalog.quote_ident(n.nspname)
||'.' FROM pg_catalog.pg_namespace n WHERE substring(pg_catalog.quote_ident(n.nspname) || '.',1,3)='baz' AND (SELECT
pg_catalog.count(*)FROM pg_catalog.pg_namespace WHERE substring(pg_catalog.quote_ident(nspname) || '.',1,3) =
substring('baz',1,pg_catalog.length(pg_catalog.quote_ident(nspname))+1))> 1UNIONSELECT
pg_catalog.quote_ident(n.nspname)|| '.' || pg_catalog.quote_ident(c.relname) FROM pg_catalog.pg_class c,
pg_catalog.pg_namespacen WHERE c.relnamespace = n.oid AND c.relkind IN ('r', 'S', 'v') AND
substring(pg_catalog.quote_ident(n.nspname)|| '.' || pg_catalog.quote_ident(c.relname),1,3)='baz' AND
substring(pg_catalog.quote_ident(n.nspname)|| '.',1,3) =
substring('baz',1,pg_catalog.length(pg_catalog.quote_ident(n.nspname))+1)AND (SELECT pg_catalog.count(*) FROM
pg_catalog.pg_namespaceWHERE substring(pg_catalog.quote_ident(nspname) || '.',1,3) =
substring('baz',1,pg_catalog.length(pg_catalog.quote_ident(nspname))+1))= 1LIMIT 1000
and the only difference in HEAD is another relkind in the IN clauses.
regards, tom lane