Ticket #1036 (closed defect: invalid)

Opened 2 months ago

Last modified 5 weeks ago

Generated SQL code for SQLite is wrong

Reported by: pedroabp5 Owned by: francois
Priority: high Milestone:
Component: Generator Version: 1.4.0
Severity: normal Keywords: SQLite primary key
Cc:

Description (last modified by francois) (diff)

The next schema:

tecnicooperativaalmacenamientoacueducto:
    _attributes: { phpName: Tecnicooperativaalmacenamientoacueducto }
    toaa_id: { phpName: ToaaId, type: INTEGER, primaryKey: true, autoIncrement: true, required: true }
    toaa_top_id: { phpName: ToaaTopId, type: INTEGER, primaryKey: true, required: true, foreignTable: tecnicooperativo, foreignReference: top_id, onDelete: RESTRICT, onUpdate: CASCADE }
    toaa_tan_id: { phpName: ToaaTanId, type: INTEGER, primaryKey: true, required: true, foreignTable: tanque, foreignReference: tan_id, onDelete: RESTRICT, onUpdate: CASCADE }

Generates the next SQL code:

CREATE TABLE [tecnicooperativaalmacenamientoacueducto]
(
	[toaa_id] INTEGER  NOT NULL PRIMARY KEY,
	[toaa_top_id] INTEGER  NOT NULL,
	[toaa_tan_id] INTEGER  NOT NULL,
	PRIMARY KEY ([toaa_id],[toaa_top_id],[toaa_tan_id])
);

Which is wrong, because inserting that code in SQLite causes the next error:

[propel-sql-exec] SQLSTATE[HY000]: General error: 1 table "tecnicooperativaalmacenamientoacueducto" has more than one primary key

Change History

comment:1 Changed 7 weeks ago by francois

  • Description modified (diff)

comment:2 Changed 5 weeks ago by francois

  • Status changed from new to closed
  • Resolution set to invalid

SQLite accepts either:

  • one single autoincrement primary key
  • a composite primary key made of several non-autoincrement columns

Your schema is probably not supported by SQLite.

More infos:  http://code.google.com/p/wwwsqldesigner/issues/detail?id=90

Note: See TracTickets for help on using tickets.