Session Extension & ALTER TABLE handling

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Session Extension & ALTER TABLE handling

Robert M. Münch
Hi, if the DB scheme was changed with ATLER TABLE (like adding a column to a table) it's no longer possible to apply a changeset from before this ALTER TABLE change.

If I'm reverting this ALTER TABLE change manually somehow, would it be possible to apply the changeset then? Or does SQLite count scheme changes incrementally, so that even then it's not possible to apply the changeset?

--

Robert M. Münch, CEO
M: +41 79 65 11 49 6

Saphirion AG
smarter | better | faster

http://www.saphirion.com
http://www.nlpp.ch

_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

signature.asc (544 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Session Extension & ALTER TABLE handling

Dan Kennedy-4
On 06/17/2017 12:56 PM, Robert M. Münch wrote:
> Hi, if the DB scheme was changed with ATLER TABLE (like adding a column to a table) it's no longer possible to apply a changeset from before this ALTER TABLE change.

I think that changed for ALTER TABLE ADD COLUMN in 3.17.0. As of 3.17,
if the changeset contains fewer columns than the database tables it is
being applied to, trailing columns are populated with their default values.

> If I'm reverting this ALTER TABLE change manually somehow, would it be possible to apply the changeset then? Or does SQLite count scheme changes incrementally, so that even then it's not possible to apply the changeset?

It would be possible. When applying a changeset, sessions just checks
that the target table has the same number or more columns than the table
the changeset was generated for, and that the PK columns are all present
and in the same positions.

Dan.



>
>
>
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Session Extension & ALTER TABLE handling

Robert M. Münch
On 17 Jun 2017, at 13:36, Dan Kennedy wrote:

> I think that changed for ALTER TABLE ADD COLUMN in 3.17.0. As of 3.17, if the changeset contains fewer columns than the database tables it is being applied to, trailing columns are populated with their default values.

Hi, I tried this but get an error "Database schema changed" when applying the inverted changeset.

--

Robert M. Münch, CEO
M: +41 79 65 11 49 6

Saphirion AG
smarter | better | faster

http://www.saphirion.com
http://www.nlpp.ch

_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

signature.asc (544 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Session Extension & ALTER TABLE handling

Dan Kennedy-4
On 06/17/2017 08:55 PM, Robert M. Münch wrote:
> On 17 Jun 2017, at 13:36, Dan Kennedy wrote:
>
>> I think that changed for ALTER TABLE ADD COLUMN in 3.17.0. As of 3.17, if the changeset contains fewer columns than the database tables it is being applied to, trailing columns are populated with their default values.
> Hi, I tried this but get an error "Database schema changed" when applying the inverted changeset.

So sqlite3changeset_apply() is returning SQLITE_SCHEMA and then calling
sqlite3_errmsg() returns "database schema has changed"?

Are there any sqlite3_log() messages?

Does the error go away if you close and reopen the database handle
immediately before passing it to sqlite3changeset_apply()?

Thanks,
Dan.




>
>
>
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Loading...