Re: psql with PHP question

Поиск
Список
Период
Сортировка
От Gyozo Papp
Тема Re: psql with PHP question
Дата
Msg-id 01b001c0d569$b3513560$4647c5d5@jaguar
обсуждение исходный текст
Ответ на Re: psql with PHP question  (Jesus Aneiros <aneiros@ucfinfo.ucf.edu.cu>)
Список pgsql-php
Hello,

just some more word :

> > In my opinion, these queries make the same :
> > SELECT id FROM article WHERE id=(SELECT MAX(id) FROM article);
> > SELECT MAX(id) FROM article;
> >
> > but the latter one is much more simple and you do not overload your pg.
> > (by the way, I think id = (SELECT ...) isn't handled gracefully.)
>
> Hi, although I agreee with the first part: the subselect is redundat in
> this case, I don't understand de second one. The subselect will return one
> value, or am I wrong? So, I think the operator = will be correct, or not?

I mean the second sentence that I don't think the planner/optimizer is so clever to reduce the former query to the
latterone.  
You're right the sublselect will return one value, but as far as I know this value should be interpreted as a set of
onevalue (because of the select). 



---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)




В списке pgsql-php по дате отправления:

Предыдущее
От: "Gyozo Papp"
Дата:
Сообщение: Re: PHP calling PHP?
Следующее
От: "Christian Marschalek"
Дата:
Сообщение: RE: PHP calling PHP?