Hi Jonathan,
If you use the XQuery function db:copy, an existing database will simply be overwritten. The much older COPY command should by all means behave identically, so I’ve just updated to BaseX to make this happen [1,2]. You can use the command XQUERY db:copy('old', 'new') if you don’t want to wait for BaseX 9.7 (but it should only be a few days from now).
Best, Christian
[1] https://files.basex.org/releases/latest/ [2] https://docs.basex.org/wiki/Commands#COPY
On Wed, Feb 16, 2022 at 9:38 PM Jonathan Robie jonathan.robie@gmail.com wrote:
What's the easiest way to copy a database, whether or not there is an existing copy with a given name?
If I load a database with CREATE DB, it replaces any existing database with the same name.
I would like to do the same with COPY DB, but it raises an error if there is a database with the same name. And DELETE DB raises an error if there isn't a database with that name. So what's the right way to do this?
Jonathan