Primary Key issues

Discussion on a SQL Parser for EasyMOD
Locked
TerraFrost
Former Team Member
Posts: 90
Joined: Wed Feb 09, 2005 12:21 am

Primary Key issues

Post by TerraFrost »

Both of the following work in phpMyAdmin, but only the latter works in the SQL Parser:

Code: Select all

CREATE TABLE demo (
   demo mediumint(8) UNSIGNED NOT NULL auto_increment PRIMARY KEY
);

CREATE TABLE demo (
   demo mediumint(8) UNSIGNED NOT NULL auto_increment,
   PRIMARY KEY (demo)
);
Are there any syntactic problems with the former that maybe I'm not aware of?

markus_petrux
Registered User
Posts: 376
Joined: Fri Jun 18, 2004 10:58 pm
Location: Girona, Catalunya (Spain)
Contact:

Re: Primary Key issues

Post by markus_petrux »

The second syntax is what we've been seen/using, so that's the one supported by the parser.

The first syntax, while it might be valid in MySQL it would make the parser more complex. Therefore, it is not supported.

I believe the goal here is not to support all the possibilities of the MySQL syntax, but to find a reasonable point where we all can do the maximum with SQL/DDL that it is possible to translate to any SQL engine supported by phpBB.

TerraFrost
Former Team Member
Posts: 90
Joined: Wed Feb 09, 2005 12:21 am

Re: Primary Key issues

Post by TerraFrost »

That's a good point - thanks for the clarification! :)

Locked