Re: [sqlite] Drop view ?automatically? when its associated table is dropped?

2017-03-24 Thread Richard Hipp
On 3/24/17, James K. Lowden wrote: > > I probably shouldn't have referred specifically to the AST. The output > I think SQLite users could benefit from isn't the emitted bytecode. > It's the parse tree: the affected objects and the operations on them. > > I don't see

Re: [sqlite] Drop view ?automatically? when its associated table is dropped?

2017-03-24 Thread James K. Lowden
On Fri, 24 Mar 2017 11:03:10 -0400 Richard Hipp wrote: > On 3/24/17, James K. Lowden wrote: > > > > We know SQLite parses SQL to produce byte-code for its virtual > > machine. And we know that's an abstract syntax tree. And we know > > trees can be

Re: [sqlite] Drop view ?automatically? when its associated table is dropped?

2017-03-24 Thread Dominique Devienne
On Fri, Mar 24, 2017 at 4:03 PM, Richard Hipp wrote: > On 3/24/17, James K. Lowden wrote: > > > > We know SQLite parses SQL to produce byte-code for its virtual > > machine. And we know that's an abstract syntax tree. And we know > > trees can be

Re: [sqlite] Drop view ?automatically? when its associated table is dropped?

2017-03-24 Thread Richard Hipp
On 3/24/17, James K. Lowden wrote: > > We know SQLite parses SQL to produce byte-code for its virtual > machine. And we know that's an abstract syntax tree. And we know > trees can be represented as tables. Therefore we know the AST could be > returned as tables.

Re: [sqlite] Drop view ?automatically? when its associated table is dropped?

2017-03-24 Thread James K. Lowden
On Fri, 24 Mar 2017 01:15:50 + Simon Slavin wrote: > SQLite does not seem to parse views or triggers for dependencies. If > it did it wouldn?t allow this view or these triggers. I guess you mean SQLite doesn't parse a view when it processes CREATE VIEW or, if it does,

Re: [sqlite] Drop view “automatically” when its associated table is dropped?

2017-03-23 Thread Daniel Anderson
Yep Sybase preparse it. When you create a view/sproc/triggers/function the objects referenced must exist or your DDL will fail. this create some complexity when we want to recreate all the objects, order of creation is very important. 2017-03-23 21:15 GMT-04:00 Simon Slavin

Re: [sqlite] Drop view “automatically” when its associated table is dropped?

2017-03-23 Thread Simon Slavin
On 24 Mar 2017, at 12:45am, Domingo Alvarez Duarte wrote: > It's not that complicated, sqlite already do all work right now but it > doesn't store that information in a structured way "data dictionary". SQLite does not seem to parse views or triggers for dependencies. If

Re: [sqlite] Drop view “automatically” when its associated table is dropped?

2017-03-23 Thread Domingo Alvarez Duarte
Hello ! It's not that complicated, sqlite already do all work right now but it doesn't store that information in a structured way "data dictionary". Cheers ! On 23/03/17 21:17, Simon Slavin wrote: On 23 Mar 2017, at 10:52pm, Daniel Anderson wrote: Sybase has one.

Re: [sqlite] Drop view “automatically” when its associated table is dropped?

2017-03-23 Thread Simon Slavin
On 23 Mar 2017, at 10:52pm, Daniel Anderson wrote: > Sybase has one. > > there is even a way to get objects dependencies Okay, thanks for the answers. The only way to do this involves quite a complicated set of dependencies. Consider, for example, having to parse a

Re: [sqlite] Drop view “automatically” when its associated table is dropped?

2017-03-23 Thread Daniel Anderson
Sybase has one. there is even a way to get objects dependencies, I have been working on a project for the last 5 years using sybase (ASE). very huge project and whenever we must alter the schema we have tools to tell us which store proc, triggers, views will be impacted. it allow us to reach the

Re: [sqlite] Drop view ?automatically? when its associated table is dropped?

2017-03-23 Thread James K. Lowden
On Thu, 23 Mar 2017 11:56:00 + Simon Slavin wrote: > > This problem and other related with the lack of a "data dictionary" > > in sqlite, > > Not sure what you expect here. Can you point me at a "data > dictionary" for some other implementation of SQL ?

Re: [sqlite] Drop view ?automatically? when its associated table is dropped?

2017-03-23 Thread James K. Lowden
On Wed, 22 Mar 2017 15:07:41 + Simon Slavin wrote: > On 22 Mar 2017, at 11:52am, R Smith wrote: > > > > May I add further that views are tricky things. They can refer to > > multiple tables, or other views which in turn refer to multiple > > tables

Re: [sqlite] Drop view “automatically” when its associated table is dropped?

2017-03-23 Thread Simon Slavin
On 23 Mar 2017, at 11:25am, Domingo Alvarez Duarte wrote: > This problem and other related with the lack of a "data dictionary" in > sqlite, Not sure what you expect here. Can you point me at a "data dictionary" for some other implementation of SQL ? Simon.

Re: [sqlite] Drop view “automatically” when its associated table is dropped?

2017-03-23 Thread Domingo Alvarez Duarte
Hello ! This problem and other related with the lack of a "data dictionary" in sqlite, would be nice to have the sql parser exposed that way we could get the database structure on the fly and solve problems like the one discussed on this thread. Cheers ! On 23/03/17 00:59, 邱朗 wrote: “Much

Re: [sqlite] Drop view “automatically” when its associated table is dropped?

2017-03-22 Thread 邱朗
“Much safer to have a habit to name views like the table names they derive from (when they derive from specific tables)” That is what I am doing right now. So thanks for all the answers I got to confirm that there is no easy way to do it. Qiulang At 2017-03-22 19:52:59, "R Smith"

Re: [sqlite] Drop view “automatically” when its associated table is dropped?

2017-03-22 Thread Jean-Luc Hainaut
On 22/03/2017 11:33, 邱朗 wrote: Hi, Is there any way to drop view “automatically” when its associated table is dropped? It seems no way to do. Then if I drop a table, is there any (easy) way to find views created based on it and I can drop view manually ? A quick and dirty procedure:

Re: [sqlite] Drop view “automatically” when its associated table is dropped?

2017-03-22 Thread Simon Slavin
On 22 Mar 2017, at 11:52am, R Smith wrote: > > May I add further that views are tricky things. They can refer to multiple > tables, or other views which in turn refer to multiple tables or yet other > views (and have obscured the names of the original tables via "AS"

Re: [sqlite] Drop view “automatically” when its associated table is dropped?

2017-03-22 Thread Dominique Devienne
On Wed, Mar 22, 2017 at 1:33 PM, Clemens Ladisch wrote: > Dominique Devienne wrote: > > On Wed, Mar 22, 2017 at 12:52 PM, R Smith wrote: > >> There is no way to easily implement an automatic view-of-table > >> dropper. (I've tried to do something like

Re: [sqlite] Drop view “automatically” when its associated table is dropped?

2017-03-22 Thread Clemens Ladisch
Dominique Devienne wrote: > On Wed, Mar 22, 2017 at 12:52 PM, R Smith wrote: >> There is no way to easily implement an automatic view-of-table >> dropper. (I've tried to do something like this for an sqlite tool long ago). > > Yes but... You can run a simple query on the view,

Re: [sqlite] Drop view “automatically” when its associated table is dropped?

2017-03-22 Thread Dominique Devienne
On Wed, Mar 22, 2017 at 12:52 PM, R Smith wrote: > On 2017/03/22 12:37 PM, Richard Hipp wrote: > >> On 3/22/17, 邱朗 wrote: >> >>> Is there any way to drop view “automatically” when its associated table >>> is dropped? >>> >>> There is no easy way to

Re: [sqlite] Drop view “automatically” when its associated table is dropped?

2017-03-22 Thread R Smith
On 2017/03/22 12:37 PM, Richard Hipp wrote: On 3/22/17, 邱朗 wrote: Hi, Is there any way to drop view “automatically” when its associated table is dropped? It seems no way to do. Then if I drop a table, is there any (easy) way to find views created based on it and I can

Re: [sqlite] Drop view “automatically” when its associated table is dropped?

2017-03-22 Thread Richard Hipp
On 3/22/17, 邱朗 wrote: > Hi, > > > Is there any way to drop view “automatically” when its associated table is > dropped? > It seems no way to do. Then if I drop a table, is there any (easy) way to > find views created based on it and I can drop view manually ? > There is no