Yes my first idea was to rename back to old name
but you cant because every sql fails with error
malformed database schema. Interest thing is that
sql Richard suggested works and no error message
returned. It looks like triggers are parsed when
other sql executed and produce error.
I found another solution and just edited with
good hex editor and change trigger definition
(rename table). I could to that without changing
size I just replace last space character with
2 so I get dokumenti2 table name. Mybe this can
be fauture request that when table is renamed
also trigger that belong to this table should
get table renamed.

Best Regards
Radovan

Bob McFarlane je 08.09.2016 ob 2:09 napisal:
Please reply if you sent this. Thanks.





-----Original Message-----
From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] On
Behalf Of Richard Hipp
Sent: Wednesday, September 7, 2016 7:49 PM
To: SQLite mailing list <sqlite-users@mailinglists.sqlite.org>
Subject: Re: [sqlite] Problem with rename table

On 9/6/16, Radovan Antloga <radovan.antl...@siol.net> wrote:
Hi Richard !

I can't find a solution how to fix my database after I have renamed
table DOKUMENTI to DOKUMENTI2.
Table DOKUMENTI had trigger dokumenti_trigger1 and after renaming
table I cant execute any sql. I forgot to drop trigger first. So now I
always get error:
malformed database schema (dokumenti_trigger1) - no such table
main.dokumenti.
Rename the table back to its old name?

Worst case:  You can drop all the triggers like this:

    PRAGMA writable_schema=ON;
    DELETE FROM sqlite_master WHERE type='trigger';

Then close and reopen your database, and you have no more triggers.
The same will work for views.  But if you try the above with tables or
indexes, you'll end up with a database that fails "PRAGMA integrity_check" -
though the corruption can be fixed with a VACUUM.
--
D. Richard Hipp
d...@sqlite.org
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users



TMGID:S11411219126200001011
_______________________________________________
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