When does constraint checking occur?

I can create a table that has a constraint on a column that doesn't exist.  I 
would expect an error on the table creation, but the table gets created 
successfully.

I'm running on windows 5.0.18 client/server.

mysql> show create table product;
+---------+-----------------------------------------------------------------------------------+
| Table   | Create Table      |
+---------+-----------------------------------------------------------------------------------+
| product | CREATE TABLE "product" (  "category" int(11) NOT NULL,  "id" 
int(11) NOT NULL,
  "price" decimal(10,0) default NULL,  PRIMARY KEY  ("category","id"))
+---------+-----------------------------------------------------------------------------

mysql> create table barbconstr (col1 int(11), constraint ts_con5 check (product.
junk > 0));
Query OK, 0 rows affected (2.63 sec)


I expected this to fail with a column "junk" doesn't exist, type of message.

The question is, why is this valid?  I hate to mention it, but this is who I 
have to compare my apps behavior to, SQL Server will return the error:
[Microsoft][ODBC SQL Server Driver][SQL Server]Invalid column 'COL7' is 
specified in a constraint or computed-column definition.

Thanks.
Barb.

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to