这是indexloc提供的服务,不要输入任何密码
Skip to content

custom_column_names not applied in SQL Query  #8314

@raphaelschwinger

Description

@raphaelschwinger

Version Information

Server Version:
CLI Version (for CLI related issue): v2.4.0-beta.1

Environment

Docker: hasura/graphql-engine:v2.2.0

What is the expected behaviour?

I added an extisting MSSQL Server Database to Hasura. This Database contains a table named Article:

CREATE TABLE [dbo].[Article](
	[Customer UUID] [uniqueidentifier] NOT NULL,
	[Number] [int] NOT NULL,
	[Name] [nvarchar](max) NULL,
	[Comparison Article] [int] NULL,
	[ABC-Category] [nchar](1) NULL,
	[Shelf Life] [int] NULL,
	[Article Group] [int] NULL,
	[Is Forecast Article] [bit] NOT NULL,
	[Cooling Type] [nvarchar](6) NULL,
 CONSTRAINT [PK_Article] PRIMARY KEY CLUSTERED 
(
	[Customer UUID] ASC,
	[Number] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

The table is tracked within hasura resulting in the following metadata:

table:
  name: Article
  schema: dbo
configuration:
  custom_column_names:
    ABC-Category: ABC_Category
    Article Group: Article_Group
    Comparison Article: Comparison_Article
    Cooling Type: Cooling_Type
    Customer UUID: Customer_UUID
    Is Forecast Article: Is_Forecast_Article
    Shelf Life: Shelf_Life
  custom_root_fields: {}

I expect to be able to run this migration:

mutation MyMutation {
  insert_Article(objects: {Is_Forecast_Article: false, Customer_UUID: "1", Number: 12}) {
    returning {
      Customer_UUID
    }
  }
}

Keywords

  • custom_column_names
  • invalid characters in this identifier
  • underscores

What is the current behaviour?

It seams that the custom_column_names are not applied "backwards", resulting in the following error:

{
  "errors": [
    {
      "extensions": {
        "internal": {
          "exception": {
            "tag": "unsuccessful_return_code",
            "contents": [
              "odbc_SQLExecDirectW",
              -1,
              "[Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Invalid column name 'Cooling_Type'."
            ]
          },
          "query": "SELECT [Cooling_Type], [ABC_Category], [Comparison_Article], [Article_Group], [Name], [Shelf_Life], [Is_Forecast_Article], [Number], [Customer_UUID] INTO #inserted FROM [dbo].[Article] WHERE (1<>1) UNION ALL SELECT [Cooling_Type], [ABC_Category], [Comparison_Article], [Article_Group], [Name], [Shelf_Life], [Is_Forecast_Article], [Number], [Customer_UUID] FROM [dbo].[Article] WHERE (1<>1)"
        },
        "path": "$",
        "code": "unexpected"
      },
      "message": "database query error"
    }
  ]
}

How to reproduce the issue?

  1. add the table as described before
  2. track table
  3. run graphql mutation in GraphiQL

Screenshots or Screencast

Bildschirmfoto 2022-03-13 um 15 13 25

Bildschirmfoto 2022-03-13 um 15 13 52

Please provide any traces or logs that could help here.

What kind of logs could I provide?

Any possible solutions?

If the bug is confirmed, would you be willing to submit a PR?

Yes, I would like to help fix this bug.

Metadata

Metadata

Assignees

Labels

k/bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions