Re: Select aliasses in where and other places of the
От | Stephan Szabo |
---|---|
Тема | Re: Select aliasses in where and other places of the |
Дата | |
Msg-id | 20030329103833.G12465-100000@megazone23.bigpanda.com обсуждение исходный текст |
Ответ на | Select aliasses in where and other places of the selectlist? (Arjen van der Meijden <acm@tweakers.net>) |
Список | pgsql-general |
On Sat, 29 Mar 2003, Arjen van der Meijden wrote: > I know it isn't possible to do queries like: > SELECT 1 AS c, c + 1 AS d; > > Other queries that aren't possible are those: > SELECT intfield AS a, intfield * intfield AS square FROM tableX WHERE a > < 10 AND square < 50 > > Of course, these are bogus examples to simply illustrate my point :) > But is there a good reason not to support it or is it something like > "not yet implemented", "not interesting" or "to complex to (easily) > implement". For the second, in the theoretical model, where clause entries are processed before the select list is evaluated. You don't want to evaluate the entire select list before testing the where (what if there's an expensive subselect or function). You could get around that by only doing the referenced ones, but you still run into issues if a select list entry has the same name as a field in one of the from entries (since to be complient it must be the field not the select list entry afaics). There'd have to be a good definition and some real gain (for particularly complicated cases you can use subselect in from to avoid double typing of the expression so I personally don't think that's good enough alone).
В списке pgsql-general по дате отправления: