Skip site navigation (1) Skip section navigation (2)

Re: psql with PHP question

From: "Gyozo Papp" <pgerzson(at)freestart(dot)hu>
To: "Jesus Aneiros" <aneiros(at)ucfinfo(dot)ucf(dot)edu(dot)cu>
Cc: <pgsql-php(at)postgresql(dot)org>
Subject: Re: psql with PHP question
Date: 2001-05-05 13:45:51
Message-ID: 01b001c0d569$b3513560$4647c5d5@jaguar (view raw or flat)
Thread:
Lists: pgsql-generalpgsql-novicepgsql-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 latter one. 
You're right the sublselect will return one value, but as far as I know this value should be interpreted as a set of one value (because of the select).



In response to

pgsql-novice by date

Next:From: tompoeDate: 2001-05-06 16:28:18
Subject: Did I fiddle too much with install?
Previous:From: Jesus AneirosDate: 2001-05-05 12:28:36
Subject: Re: psql with PHP question

pgsql-php by date

Next:From: Christian MarschalekDate: 2001-05-05 15:40:47
Subject: RE: PHP calling PHP?
Previous:From: Gyozo PappDate: 2001-05-05 13:32:56
Subject: Re: PHP calling PHP?

pgsql-general by date

Next:From: Witold RakDate: 2001-05-05 13:58:24
Subject: How tnaslate kode from MySQL to Postgres?
Previous:From: Christian MarschalekDate: 2001-05-05 13:15:15
Subject: RE: [ADMIN] Primary Keys

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group