[GENERAL] correlated query as a column and where clause

2011-04-15 Thread salah jubeh
Hello All, I am wondering, why I can not add the following ' A 10' in the where clause i.e. 'where nspname !~* 'pg_' and A 10' Select nspname, (SELECT count(*) as count FROM pg_tables where schemaname = nspname) as A FROM pg_namespace where nspname !~* 'pg_' Thanks in advance

Re: [GENERAL] correlated query as a column and where clause

2011-04-15 Thread Harald Armin Massa
I am wondering, why I can not add the following ' A 10' in the where clause i.e. 'where nspname !~* 'pg_' and A 10' Select nspname, (SELECT count(*) as count FROM pg_tables where schemaname = nspname) as A FROM pg_namespace where nspname !~* 'pg_' what you are looking for is

Re: [GENERAL] correlated query as a column and where clause

2011-04-15 Thread Chris Curvey
On Fri, Apr 15, 2011 at 11:22 AM, salah jubeh s_ju...@yahoo.com wrote: Hello All, I am wondering, why I can not add the following ' A 10' in the where clause i.e. 'where nspname !~* 'pg_' and A 10' Select nspname, (SELECT count(*) as count FROM pg_tables where schemaname =

Re: [GENERAL] correlated query as a column and where clause

2011-04-15 Thread salah jubeh
statement ( as in the original post) in the where clause. Regards From: Chris Curvey ch...@chriscurvey.com To: salah jubeh s_ju...@yahoo.com Cc: pgsql pgsql-general@postgresql.org Sent: Fri, April 15, 2011 5:28:39 PM Subject: Re: [GENERAL] correlated query

Re: [GENERAL] correlated query as a column and where clause

2011-04-15 Thread salah jubeh
: Fri, April 15, 2011 5:26:45 PM Subject: Re: [GENERAL] correlated query as a column and where clause I am wondering, why I can not add the following ' A 10' in the where clause i.e. 'where nspname !~* 'pg_' and A 10' Select nspname, (SELECT count(*) as count FROM pg_tables where

Re: [GENERAL] correlated query as a column and where clause

2011-04-15 Thread Tom Lane
salah jubeh s_ju...@yahoo.com writes: But, why I can not use the alias of the select statement ( as in the original post) in the where clause. The select list can only be computed after the where clause has filtered the rows, so such a thing would be circular.

Re: [GENERAL] correlated query as a column and where clause

2011-04-15 Thread salah jubeh
From: Tom Lane t...@sss.pgh.pa.us To: salah jubeh s_ju...@yahoo.com Cc: ch...@chriscurvey.com; pgsql pgsql-general@postgresql.org Sent: Fri, April 15, 2011 5:49:35 PM Subject: Re: [GENERAL] correlated query as a column and where clause salah jubeh s_ju...@yahoo.com writes