SQLite Forum

attach-stmt syntax documentation ?
Login

attach-stmt syntax documentation ?

(1) By Bob C (rchapman) on 2020-06-07 21:09:58 [link] [source]

In the documentation for attach-stmt (syntax/attach-stmt.html) and ATTACH DATABASE (lang_attach.html) the statement is shown as: ATTACH DATABASE expr AS schema-name with a link to the documentation for expr (syntax/expr.html). It may be an artifact of my ignorance but I don't understand how the syntax diagram for expr describes a path to the database file that is being attached.

(2) By Stephan Beal (stephan) on 2020-06-07 21:36:49 in reply to 1 [link] [source]

I don't understand how the syntax diagram for expr describes a path to the database file that is being attached.

The expression may be arbitrarily complex, so long as it resolves to a value suitable for use as a file name. As a trivial example:

attach 'a' || '.db' as foo

(3.1) By Bob C (rchapman) on 2020-06-08 13:41:17 edited from 3.0 in reply to 2 [source]

Aha!

. . . so long as it resolves to a value suitable for use as a file name.

That stipulation dispels my confusion. I guess it should have been obvious? Thanks for the explanation. Sorry for the noise! ;)