sqlserver2pgsql icon indicating copy to clipboard operation
sqlserver2pgsql copied to clipboard

Incorrect parsing of view DDLs

Open shubham-yb opened this issue 2 years ago • 0 comments

Hi Team, If we have columns in square brackets in the source sql server schema as well as the dump, the columns in the view DDL gets parsed as is with the brackets which causes errors.

Source schema:

CREATE VIEW [Male_emp] 
AS
SELECT 
[Name], [Gender]
FROM Employee
WHERE Gender = 'Male';

go

Dump file using mssql-scripter:

/****** Object:  View [dbo].[Male_emp]    Script Date: 2/27/23 8:17:03 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER OFF
GO

CREATE VIEW [dbo].[Male_emp]
AS
SELECT
[Name], [Gender]
FROM Employee
WHERE Gender = 'Male';

GO

Converted schema:

CREATE VIEW "public"."male_emp" AS
SELECT
[Name], [Gender]
FROM Employee
WHERE Gender = 'Male';

Corresponding error:

ERROR:  syntax error at or near "["
LINE 3: [Name], [Gender]
        ^

Thanks a lot for your help.

shubham-yb avatar Feb 27 '23 08:02 shubham-yb