[DBIx-Class-Devel] [dbsrgits/sql-translator] SQL::Translator::Producer::Sybase generates invalid CREATE TABLE statements (#93)

Matthew Musgrove notifications at github.com
Thu Jul 13 17:46:16 GMT 2017


The SQL produced for any table with an identity column will be invalid.

```
[1] fake.fake.1> sp_help TestProducer;
 Name                     Owner      Object_type            Object_status              Create_date                           
 ------------------------ ---------- ---------------------- -------------------------- --------------------------------------
 TestProducer             dbo        user table              -- none --                Jul 13 2017 12:42PM                   

(1 row affected)
 Column_name            Type           Length       Prec     Scale      Nulls      Not_compressed               Default_name             Rule_name          Access_Rule_name                 Computed_Column_object                       Identity            
 ---------------------- -------------- ------------ -------- ---------- ---------- ---------------------------- ------------------------ ------------------ -------------------------------- -------------------------------------------- --------------------
 TestID                 numeric             5          9         0          0                   0               NULL                     NULL               NULL                             NULL                                                  1          
 TestVar                varchar             2       NULL      NULL          0                   0               NULL                     NULL               NULL                             NULL                                                  0          
 TestChr                char                1       NULL      NULL          1                   0               NULL                     NULL               NULL                             NULL                                                  0          
Object does not have any indexes.
No defined keys for this object.
```

If I have SQL::Translator::Producer::Sybase dump out the SQL for this table then I get this (comments and blank lines removed):
```
CREATE TABLE TestProducer (
  TestID IDENTITY numeric(9,0) NOT NULL,
  TestVar varchar(2) NOT NULL,
  TestChr char(1) NULL
);
```

Notice that IDENTITY falls before the datatype which is invalid, will not load in Sybase and rightly causes SQL::Translator::Parser::Sybase to error out.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/dbsrgits/sql-translator/issues/93
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.scsys.co.uk/pipermail/dbix-class-devel/attachments/20170713/34ca2b34/attachment-0001.htm>


More information about the DBIx-Class-Devel mailing list