Skip to content

Incorrect parsing of view DDLs #174

@shubham-yb

Description

@shubham-yb

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions