[sqlite] Unique qualifier

3 views
Skip to first unread message

Bryce Lembke

unread,
Mar 12, 2012, 11:49:44 AM3/12/12
to sqlite...@sqlite.org
I cannot seem to get the UNIQUE constraint to work in sqlite.

The following is the trace from my command line.

Note that if I remove the UNIQUE constraint, it works fine.

C:\>sqlite myDB.db

SQLite version 3.6.17

Enter ".help" for instructions

Enter SQL statements terminated with a ";"

sqlite> CREATE TABLE employees (id INTEGER PRIMARY KEY,name TEXT
UNIQUE);

SQL error: SQL logic error or missing database

sqlite> CREATE TABLE employees (id INTEGER PRIMARY KEY,name TEXT);

sqlite>

The examples I have seen are using this syntax, what am I doing wrong?

Bryce

_______________________________________________
sqlite-users mailing list
sqlite...@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Simon Davies

unread,
Mar 12, 2012, 12:18:44 PM3/12/12
to General Discussion of SQLite Database
On 12 March 2012 15:49, Bryce Lembke <bry...@vpieng.com> wrote:
> I cannot seem to get the UNIQUE constraint to work in sqlite.
>
> The following is the trace from my command line.
>
> Note that if I remove the UNIQUE constraint, it works fine.
>
> C:\>sqlite myDB.db
>
> SQLite version 3.6.17
>
> Enter ".help" for instructions
>
> Enter SQL statements terminated with a ";"
>
> sqlite> CREATE TABLE employees (id INTEGER PRIMARY KEY,name TEXT
> UNIQUE);
>
> SQL error: SQL logic error or missing database
>
> sqlite> CREATE TABLE employees (id INTEGER PRIMARY KEY,name TEXT);
>
> sqlite>
>
> The examples I have seen are using this syntax, what am I doing wrong?
>
> Bryce
>

I have just tried your table create statement in versions 3.3.14 and
3.7.10 on Win7; in both cases no error

SQLite version 3.3.14
Enter ".help" for instructions


sqlite> CREATE TABLE employees (id INTEGER PRIMARY KEY,name TEXT UNIQUE);

sqlite>

Where does your shell come from? What environment?

Regards,
Simon

Bryce Lembke

unread,
Mar 12, 2012, 3:37:47 PM3/12/12
to sqlite...@sqlite.org
Yes. It is odd.

I am using the cmd prompt using WindowsXP. I have also tried it on a
separate Windows7 machine with the same results.

My shell is just doing Start->run then I type "cmd".

I am going to try with a different version of sqlite.


Bryce

Re: [sqlite] Unique qualifier

Simon Davies
Mon, 12 Mar 2012 09:18:58 -0700

Bryce Lembke

unread,
Mar 12, 2012, 4:22:29 PM3/12/12
to Bryce Lembke, sqlite...@sqlite.org
OK. I moved to 3.7.10 and it works fine now.

I was using the 3.6.17 that was included with EJSCRIPT. I am wondering
if there is an issue with that one, but I am good for now.

Thanks.

Bryce

Reply all
Reply to author
Forward
0 new messages