squirrel-sql-client / squirrel-sql-code

Share of the SQuirreL SQL source code originating from SourceForge, see https://squirrelsql.org
GNU Lesser General Public License v2.1
59 stars 11 forks source link

Generate create table script does not work properly when a column is auto increment and primary key #29

Open MitchellPuls opened 4 months ago

MitchellPuls commented 4 months ago

When you create a table that has a column that is both auto increment, and a primary key, and you afterwards try to export a create table script from it, it will remove the auto increment part of it.

Steps to reproduce:

  1. Create a table: CREATE TABLE TEST (TEST INT NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 0, INCREMENT BY 1) PRIMARY KEY);
  2. Verify table in objects view > columns image
  3. Right click table TEST > Scripts > Create table script

Expected result: Create table query with a column with both auto increment, and primary key properties Actual result: Create table query with only a primary key property

This is a property I found now, do not know if other column properties have the same issue

gerdwagner commented 4 months ago

There are a variety of mechanisms to define an auto increment column. These mechanisms are not limited to different syntaxes in the column definition clause. For details see https://www.w3schools.com/sql/sql_autoincrement.asp

That is why we do not support it in SQuirreL's table scripting.