You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Input: sqlglot.transpile('create table x (i int identity(1,1) not null)', read='tsql', write='postgres')
Output: ['CREATE TABLE x (i INT GENERATED AS IDENTITY (START WITH 1 INCREMENT BY 1) NOT NULL)']
Expected: ['CREATE TABLE x (i INT GENERATED ALWAYS AS IDENTITY (START WITH 1 INCREMENT BY 1) NOT NULL)']
Input: sqlglot.transpile('create table x (i uniqueidentifier not null default(newid()))', read='tsql', write='postgres')
Output: ['CREATE TABLE x (i UNIQUEIDENTIFIER NOT NULL DEFAULT (NEWID()))']
Expected: ['CREATE TABLE x (i uuid NOT NULL DEFAULT (gen_random_uuid()))']
Input: sqlglot.transpile('create table x (i int not null) on primary', read='tsql', write='postgres')
Output: ['CREATE TABLE x (i INT NOT NULL) ON primary']
Expected: Couple of options here. Simplest, just strip the "ON primary" as (AFAIK) there's no equivalent in Postgres. But maybe it would be nice to give the user an error in this sort of situation, and have a flag that ignores unconvertable syntax?
I'm happy to personally help work on any/all of these if you agree that they're good enhancements.
The text was updated successfully, but these errors were encountered:
@amachanic would love these contributions from you. we look forward to working with you on the pr's. going to close for now as we close issues that aren't being actively worked on by core team.
feel free to join us on slack if you want to ask us direct questions tobikodata.com/slack
sqlglot 26.4.1
Input:
sqlglot.transpile('create table x (i int identity(1,1) not null)', read='tsql', write='postgres')
Output:
['CREATE TABLE x (i INT GENERATED AS IDENTITY (START WITH 1 INCREMENT BY 1) NOT NULL)']
Expected:
['CREATE TABLE x (i INT GENERATED ALWAYS AS IDENTITY (START WITH 1 INCREMENT BY 1) NOT NULL)']
Input:
sqlglot.transpile('create table x (i uniqueidentifier not null default(newid()))', read='tsql', write='postgres')
Output:
['CREATE TABLE x (i UNIQUEIDENTIFIER NOT NULL DEFAULT (NEWID()))']
Expected:
['CREATE TABLE x (i uuid NOT NULL DEFAULT (gen_random_uuid()))']
Input:
sqlglot.transpile('create table x (i int not null) on primary', read='tsql', write='postgres')
Output:
['CREATE TABLE x (i INT NOT NULL) ON primary']
Expected: Couple of options here. Simplest, just strip the "ON primary" as (AFAIK) there's no equivalent in Postgres. But maybe it would be nice to give the user an error in this sort of situation, and have a flag that ignores unconvertable syntax?
I'm happy to personally help work on any/all of these if you agree that they're good enhancements.
The text was updated successfully, but these errors were encountered: