change the order of FROM selection to make query work - Mailing list pgsql-general

From Thomas Peter
Subject change the order of FROM selection to make query work
Date
Msg-id nFfTliMb.1159276529.1504170.sol00-thomas@sol00.hostsharing.net
Whole thread Raw
Responses Re: change the order of FROM selection to make query work  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: change the order of FROM selection to make query work  ("Brandon Aiken" <BAiken@winemantech.com>)
List pgsql-general
hi,
posted this twice allready, but didn't seem to make it to the list.
so one more try:

i support a trac [1] installation and migrated the backend from sqlite to
postgres 8.1.4, which worked fine, but:
the following sql stopped working with postgres, and the fix of this
problem seems strange to me.
first the old sql, that worked with sqlite:

SELECT
p.value AS __color__,
id AS ticket, summary, status, priority ,component, t.type AS type,
time AS created,
changetime AS _changetime, description AS _description,
reporter AS _reporter
FROM ticket as t, permission as perm, enum as p
WHERE status IN ('new', 'assigned', 'reopened') AND perm.action =
'mf'
and p.name = t.priority AND p.type='priority'
ORDER BY priority, type, time

and the fix was, to put the 'ticket as t' at the end in the FROM
statement.
changing
FROM ticket as t, permission as perm, enum as p
to
FROM permission as perm, enum as p, ticket as t
works like expected!

so is this a bug, or do i get soemthing wrong (a hint where to rtfm would
be very welcome in this case)

thanx,
thomas

[1] trac.edgewall.org

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Restart after poweroutage
Next
From: Jon Lapham
Date:
Subject: Re: Restart after poweroutage