X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D92D5329EAB for ; Tue, 21 Sep 2004 23:44:29 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 16373-10 for ; Tue, 21 Sep 2004 22:44:20 +0000 (GMT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id 50BD7329EA5 for ; Tue, 21 Sep 2004 23:44:22 +0100 (BST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.12.9/8.12.9) with ESMTP id i8LMiJfg019033 for ; Tue, 21 Sep 2004 22:44:19 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.12.9/8.12.9/Submit) id i8LMGMiR011090 for pgsql-sql@postgresql.org; Tue, 21 Sep 2004 22:16:22 GMT From: Mischa Sandberg Reply-To: ischamay.andbergsay@activestateway.com User-Agent: Mozilla Thunderbird 0.7.3 (X11/20040803) X-Accept-Language: en-us, en MIME-Version: 1.0 X-Newsgroups: comp.databases.postgresql.sql Subject: Re: COUNT(*) to find records which have a certain number of dependencies References: <414EF3E6.9040202@numerixtechnology.de> <87llf4hjv2.fsf@stark.xeocode.com> <414F348A.2020608@numerixtechnology.de> <877jqohdoj.fsf@stark.xeocode.com> In-Reply-To: <877jqohdoj.fsf@stark.xeocode.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Lines: 41 Message-ID: Date: Tue, 21 Sep 2004 22:16:24 GMT To: pgsql-sql@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.1 tagged_above=0.0 required=5.0 tests=NO_DNS_FOR_FROM X-Spam-Level: * X-Archive-Number: 200409/223 X-Sequence-Number: 19069 Greg Stark wrote: > T E Schmitz writes: >>) as somealias on (model_fk = model_pk) >>(subquery in FROM must have an alias) > > ARGH! This is one of the most annoying things about postgres! It bites me all > the time. Obviously it's totally insignificant since it's easy for my to just > throw an "AS x" on the end of it. But damn. > > So where can I officially register my complaint? :) Hope you don't mind an opinion from someone who looks at this from the underside ... Trying to give the parser a better chance of confusing you? Having the tag only totally insignificant if you want to have a bunch of special validation cases, where if there is only ONE anonymous pseudotable, and no ambiguity is possible. If all it does is give you an annoying but understandable error message, might you care to consider the cryptic error messages you get from systems that try to 'do what you mean, not what you say' for such special cases ... and thereby turn a typo into an error twenty lines further down the page. BTW, the "as" is optional, but I always suggest that people use it explicitly. Why? Because without it, you get another silly error message or even a runtime error when what you did was omit a comma. For example select salary name from Employee returns one column (a dollar figure called "name"). (Yes, I know it's harder to cook up an example when the comma is missing between tables in the FROM list; just wanted it to be obvious) Okay, apologies for what may sound like a rant. I've just been wrangling with an interpreter that tries WAY too hard to make something executable out of what you tell it ... even if that's really nothing like your intent.