On 07/23/2016 08:49 PM, R Smith wrote:


On 2016/07/23 3:30 PM, Simon Slavin wrote:
On 23 Jul 2016, at 2:24pm, R Smith <rsm...@rsweb.co.za> wrote:

No, it's not possible to forge permanent references to/from temporary tables - it defies the objective of being "temporary".
The other way around should fine, though: use a permanent table to ensure that only legitimate values appear in a temporary table.

I will in fact be surprised to find out you can even reference another temp table... perhaps this might be possible since both tables will definitely cease to exist upon connection closure.
I don't see why this shouldn't be allowed. Assuming that the 'parent' temporary table has the appropriate index. SQLite doesn't support CREATE TEMPORARY UNIQUE INDEX but it should understand that an index created on a temporary table is temporary.

Yes, your reasoning feels right, but I'm coming from the idea that references (much like Indices and such) are really database objects themselves, stand-alone units if you will, and they need to have concrete (non-temporary) linking or at least not mixed temporary-permanent linking. This is of course not necessarily true, and possibly quite different in SQLite (where it might be more like a check-constraint or such), so your point may have merit here and perhaps allowing referencing FROM a temporary table to a permanent table could simply be a minor tweak in some line of code inside SQLite.

The trouble is that some other process may come along and modify the permanent table, violating the FK constraint in the temporary schema.

Dan.


_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to