On Sat, Jan 8, 2011 at 12:45, Carlos Konstanski
<[email protected]> wrote:
> SELECT ID,START_DATE,END_DATE,CREATEDBY,NAME FROM businesses WHERE id in ()
> ORDER BY name ASC;
>
> The above query will fail in postgresql 9.0 because of the empty list in the
> WHERE clause. Is this standard ANSI SQL behavior, or is it a postgresql quirk?

MySQL will also fail because of an empty list so it's not just
PostgreSQL.  SQLite will not fail.

>From SQLite's website (http://www.sqlite.org/lang_expr.html#in_op):
"Note that SQLite allows the parenthesized list of scalar values on
the right-hand side of an IN or NOT IN operator to be an empty list
but most other SQL database database engines and the SQL92 standard
require the list to contain at least one element."


Cheers,

Daniel Hedlund
[email protected]
_______________________________________________
PLUG mailing list
[email protected]
http://lists.pdxlinux.org/mailman/listinfo/plug

Reply via email to