SQL gotcha - Mailing list pgsql-sql

From Dean Gibson (DB Administrator)
Subject SQL gotcha
Date
Msg-id 4D59BAD5.4090306@ultimeth.com
Whole thread Raw
Responses Re: SQL gotcha  (Achilleas Mantzios <achill@matrix.gatewaynet.com>)
List pgsql-sql
As you all know, when you specify an alias for a table or column name, the keyword "AS" is usually optional.  I
personallylike to always include the "AS" keyword, if for no other reason than readability, and I presume that always
using"AS" might catch some syntactic errors as well.<br /><br /> However, recently I ran across a statement where the
optionalityof the "AS" keyword caused me some grief:<br /><blockquote>SELECT ... FROM aaa LEFFT JOIN bbb WHERE ...<br
/></blockquote>Note the (unintentional) misspelling of the keyword "LEFT".  PostgreSQL took "LEFFT" to be an alias for
table"aaa" and silently accepted the statement;  naturally I did not get the results I expected !!<br /><br /> If
PostgreSQLhad an option to always require the "AS", that would have caught this error.  Is there any interest in
PostgreSQLhaving any "pedantic"-type options, like many C/C++ compilers do?<br /><br /><pre class="moz-signature"
cols="72">--
 
Mail to my list address MUST be sent via the mailing list.
All other mail to my list address will bounce.</pre>

pgsql-sql by date:

Previous
From: Gavin Beau Baumanis
Date:
Subject: Re: UTF characters compromising data import.
Next
From: Achilleas Mantzios
Date:
Subject: Re: SQL gotcha