DPS Initial Ideas

Rick C. Petty rick-freebsd at kiwi-computer.com
Mon May 14 21:51:30 UTC 2007


On Mon, May 14, 2007 at 10:25:12AM +0200, 'Michel Talon' wrote:
> 
> niobe% sqlite3 index.db
> sqlite> CREATE TABLE index6 (
> pkgname varchar(1),
> path varchar(1),
> prefix varchar(1),
> comment varchar(1),
> descr varchar(1),
> maintainer varchar(1),
> categories varchar(1),
> build_deps varchar(1),
> run_deps varchar(1),
> website varchar(1),
> extract_deps varchar(1),
> patch_deps varchar(1),
> fetch_deps varchar(1));
> sqlite> .import INDEX-6 index6
> ... completes in less than 2 seconds
> sqlite> select * from index6 where path = "/usr/ports/accessibility/atk";
> atk-1.12.4|/usr/ports/accessibility/atk|/usr/local|A GNOME accessibility
> toolkit
> (ATK)|/usr/ports/accessibility/atk/pkg-descr|gnome at FreeBSD.org|accessibility
> devel|gettext-0.14.5_2 glib-2.12.9 libiconv-1.9.2_2 libtool-1.5.22_3
> perl-5.8.8 pkg-config-0.21|gettext-0.14.5_2 glib-2.12.9 libiconv-1.9.2_2
> perl-5.8.8
> pkg-config-0.21|http://developer.gnome.org/projects/gap/||libtool-1.5.22_3|

What this shows me is that sqlite doesn't follow SQL92 standards.
According to the section 6.1 of the standard[1]:

Syntax rule #1 states "VARCHAR is equivalent to CHARACTER VARYING."
Syntax rule #9b states
	"If VARYING is specified in <character string type>, then the
	length in characters of the character string is variable,
	with a minimum length of 0 and a maximum length of the value
	of <length>."

So your example should have failed to work correctly.  You should have used
something more appropriate, like VARCHAR(255) instead of VARCHAR(1).

If SQLite isn't even standards-compliant, why is anyone considering it?  =)
Nitpicky, I know, but it makes me wonder what else they don't follow...

-- Rick C. Petty

[1] http://www.contrib.andrew.cmu.edu/~shadow/sql/sql1992.txt


More information about the freebsd-hackers mailing list