On 12 Mar 2011, at 9:35am, Jonathan Allin wrote:

> I can impose a CHECK constraint on a table when I create it. A perhaps
> non-PC example: 
> 
> 
> 
> CREATE TABLE employers (id INTEGER, name TEXT, age INTEGER, office INTEGER
> REFERENCES offices, PRIMARY KEY (id), CHECK (age > 10 AND age < 90))
> 
> 
> 
> However:
> 
> (1)    Can I add new check constraints after I've created the table?

Nope.  Make a new table and copy your data across.

> (2)    How can I list all the existing check constraints?
> 
> (3)    Can I also see which triggers have been created?
> 
> 
> 
> As a general comment, it would seem essential that a SQLite database file
> can be interrogated to identify ALL of its metadata. There are pragmas etc
> to access table names, details of table columns, and indexes. However I
> couldn't see any way to identify check constraints and triggers.

The best you can do is

SELECT * FROM sqlite_master

and look at the results.  You'll have to write your own parser.

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

Reply via email to