This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 205895 - create sql is not quite correct
Summary: create sql is not quite correct
Status: NEW
Alias: None
Product: db
Classification: Unclassified
Component: Code (show other bugs)
Version: 7.1
Hardware: Macintosh Mac OS X
: P3 normal (vote)
Assignee: Libor Fischmeistr
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-03 10:17 UTC by medeag
Modified: 2013-08-08 12:02 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description medeag 2011-12-03 10:17:17 UTC
I have created database using query from (http://www.w3schools.com/sql/sql_check.asp)

CREATE TABLE Persons
(
P_Id int NOT NULL,
LastName varchar(255) NOT NULL,
FirstName varchar(255),
Address varchar(255),
City varchar(255),
CHECK (P_Id>0)
)

but when i click on Show SQL Script for CREATE i only see:

CREATE TABLE persons (P_Id INT NOT NULL, LastName VARCHAR(255) NOT NULL, FirstName VARCHAR(255), Address VARCHAR(255), City VARCHAR(255));


Product Version: NetBeans IDE 7.1 (Build 201112012200)
Java: 1.6.0_29; Java HotSpot(TM) 64-Bit Server VM 20.4-b02-402
System: Mac OS X version 10.6.8 running on x86_64; MacRoman; ka_GE (nb)
Comment 1 matthias42 2011-12-04 13:15:15 UTC
You didn't mention your database server - but you have to know, that SQL is not as standardized as would be nice. Every vendor interprets SQL a bit different. In this case I had a look at the mysql documentation and found this:

"[...]. The CHECK clause is parsed but ignored by all storage engines.[...]"

from: http://dev.mysql.com/doc/refman/5.1/en/alter-table.html

So there is no representation of the check constraint after the creation of the table. If you use mysql this bug can be closed as notabug, if you use another dbms more checks are needed.
Comment 2 medeag 2011-12-04 14:16:42 UTC
i was not aware of mysql behavior, thanks for information, but i  checked also on  postgresql had this capability (e.g. see  
CREATE TABLE distributors (
    did     integer,
    name    varchar(40)
    CONSTRAINT con1 CHECK (did > 100 AND name <> '') 
); 
from http://www.postgresql.org/docs/8.4/static/sql-createtable.html )
but  still no check there...