This makes me feel there is a lot of pain coming in the future.

Given an update statement for n dbs of unknown state,
When a db lacks columns necessary to successfully execute the sql
Then add the columns to the db

I'm trying to imagine how to keep n remote dbs in a known state, say z,
when various updates sent to them put result in states a, b, c, d...z. How
do you keep all the db states sync'd when update 1 could create a column
but it fails or was not sent to all n dbs, and update 2 could create a
column but it fails or was not sent to all n dbs? How do you know what
state each remote db is in, or isn't in?

On Wed, Aug 1, 2018 at 10:46 AM R Smith <ryansmit...@gmail.com> wrote:

> On 2018/08/01 5:29 PM, Charles Leifer wrote:
> > You can simply use:
> >
> > PRAGMA table_info('my_table')
> >
> > To get a list of columns, which you can check against and then
> > conditionally add your column.
>
> Aye, but during a script in SQL-only you don't have that luxury. One
> could also use a similar pragma to check if a table exists before
> creating it, but the SQL for:
> CREATE TABLE IF NOT EXISTS... makes it possible to add things without
> failing mid-script with no programmatic help (and to be blunt, much
> easier and nicer).
>
> That said, I never add columns this way -  but that might only be
> precisely because its IF NOT EXISTS does not exist. So...
>
> +1
>
>
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to