> I'm not going to choose a random table like that.   the DB needs to 
> support running this kind of query correctly.  This is just PG and 
> MySQL.   we have all the others to see how badly they screw this up 
> also. 
>

I naively thought that the statement 'SELECT 1 WHERE 1 != 1" would work on 
any DB, but it seems it won't be the case as it is a syntax error on 
mariaDB (and I guess on some other DB then).

However any BD implementing IN predicate accepting a subquery as the list 
must implement a coherent way to deal with empty list on IN (or at least 
send a proper error message), as a subquery producting an empty result is a 
perfectly valid query.

So this "trick" might be adaptable to all DB (I didn't managed to find the 
doc of IN for synbase and oracle so I can't tell for them).
Moreover sqlite, postgres, myqsl and mariaDB agree on the (NULL IN () == 
False) question, so letting the DB create the empty list shouldn't lead too 
much to a "SQLAlchemy is not abstracting differences between the 
databases!!".

The statement "SELECT 1 FROM ((SELECT 1) as placeholder_table) WHERE 1!=1;" 
is more promising, as (sqlite, postgres, myqsl and mariaDB) all accept it, 
and any DB that accept a select query as a valid table too (it looks like 
Microsoft SQL server will accept it too, can't say for firebird, oracle or 
sybase as I found niether a doc or a way to make it run).


What is the procedure to propose a PR (with tests obviously) ? Issues are 
supposed to be in bitbucket, but most PR are on the github

-- 
Nicolas Rolin


-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to