Greg Stark wrote:
> T E Schmitz <mailreg@numerixtechnology.de> 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
messagesyou 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
wantedit 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.