Discussion:
create table if not exists & virtual table?
Petite Abeille
2008-08-26 18:50:33 UTC
Permalink
Hello,

Is it possible to use 'if not exists' in conjunction with the creation
DDL for a virtual table?

For example:

create table if not exists document( content text )

vs.

create virtual table if not exists document using fts3( content text )

The first statement works as advertise, but the second one fails with
a syntax error:

SQL error: near "not": syntax error

What gives?

Thanks in advance.

Cheers,

--
PA.
http://alt.textdrive.com/nanoki/
Dennis Cote
2008-08-26 21:34:18 UTC
Permalink
Post by Petite Abeille
Is it possible to use 'if not exists' in conjunction with the creation
DDL for a virtual table?
No, its not possible.

The syntax of a "create table" statement is shown here
http://www.sqlite.org/lang_createtable.html and that for a "create
virtual table" statement is shown here
http://www.sqlite.org/lang_createvtab.html. The virtual table statement
does not allow the optional "if not exists" clause.

HTH
Dennis Cote
Petite Abeille
2008-08-27 16:20:35 UTC
Permalink
Hello,
Post by Dennis Cote
Post by Petite Abeille
Is it possible to use 'if not exists' in conjunction with the
creation
DDL for a virtual table?
No, its not possible.
The syntax of a "create table" statement is shown here
http://www.sqlite.org/lang_createtable.html and that for a "create
virtual table" statement is shown here
http://www.sqlite.org/lang_createvtab.html. The virtual table
statement
does not allow the optional "if not exists" clause.
Hmmm... bummer... any reason for such discrepancy? This 'if not
exists' clause is rather handy :)

Is there a place where one could raise a feature request for such
functionality?

Thanks in advance.

Cheers,

--
PA.
http://alt.textdrive.com/nanoki/
Dennis Cote
2008-08-27 16:45:25 UTC
Permalink
Post by Petite Abeille
Is there a place where one could raise a feature request for such
functionality?
Sure. Go to http://www.sqlite.org/cvstrac/captcha?nxp=/cvstrac/tktnew
and file a New Feature request.

HTH
Dennis Cote
Scott Hess
2008-08-28 21:39:03 UTC
Permalink
There is already such a feature request at:
http://www.sqlite.org/cvstrac/tktview?tn=2604

I just added a patch there which, I believe, implements this. I'm
going to float it on sqlite-dev to see if I'm missing anything.

-scott


On Wed, Aug 27, 2008 at 9:20 AM, Petite Abeille
Post by Petite Abeille
Hello,
Post by Dennis Cote
Post by Petite Abeille
Is it possible to use 'if not exists' in conjunction with the creation
DDL for a virtual table?
No, its not possible.
The syntax of a "create table" statement is shown here
http://www.sqlite.org/lang_createtable.html and that for a "create
virtual table" statement is shown here
http://www.sqlite.org/lang_createvtab.html. The virtual table
statement
does not allow the optional "if not exists" clause.
Hmmm... bummer... any reason for such discrepancy? This 'if not
exists' clause is rather handy :)
Is there a place where one could raise a feature request for such
functionality?
Thanks in advance.
Cheers,
--
PA.
http://alt.textdrive.com/nanoki/
_______________________________________________
sqlite-users mailing list
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Petite Abeille
2008-08-30 16:12:15 UTC
Permalink
Post by Scott Hess
http://www.sqlite.org/cvstrac/tktview?tn=2604
I just added a patch there which, I believe, implements this. I'm
going to float it on sqlite-dev to see if I'm missing anything.
Nice :) Hope to see this patch included in a future release as it's a
rather convenient syntax.

Cheers,

--
PA.
http://alt.textdrive.com/nanoki/

Continue reading on narkive:
Loading...