Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mssql: sql: Scan error on column index 2, name "index_name": converting NULL to string is unsupported from atlas schema inspect #3266

Open
AnielaN994 opened this issue Dec 16, 2024 · 6 comments
Assignees
Labels

Comments

@AnielaN994
Copy link

Hello,

We have tables partitioned by scheme that I've understood they'll be supported by atlas in feature releases and for some of those partitioned by scheme tables, there is no Primary key created. Hence there is a default heap entry in sys.indexes that has the name NULL.

Due to this, at atlas schema inspect, "Error: mssql: sql: Scan error on column index 2, name "index_name": converting NULL to string is unsupported" is returned. When I create myself the PK on the table, the error is no more encountered.

When the migration is done with flyway, the error is not encountered from the default heap entry in sys.indexes.

Is there any solution for this ?

Many Thanks.

@giautm
Copy link
Member

giautm commented Dec 16, 2024

Hello, can you please share the SQL that create the table?

@AnielaN994
Copy link
Author

CREATE TABLE [test].[exec_log](
[partition_key] [int] NOT NULL,
[host_name] nvarchar NOT NULL,
[error_msg] nvarchar NOT NULL
) ON psLog -- psLog is the partition scheme
GO

@giautm
Copy link
Member

giautm commented Dec 16, 2024

Sorry, also the create schema script. I need the sql to preproduce the issue

@AnielaN994
Copy link
Author

`CREATE PARTITION FUNCTION pfLog AS RANGE RIGHT FOR VALUES (20220101, 99999999)
GO
CREATE PARTITION SCHEME [psLog] AS PARTITION [pfLog] TO ([PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY])
GO

CREATE TABLE [test].[exec_log](
[partition_key] [int] NOT NULL,
[host_name] nvarchar NOT NULL,
[error_msg] nvarchar NOT NULL
) ON psLog
GO `

@giautm
Copy link
Member

giautm commented Dec 16, 2024

Hello @AnielaN994, we will exclude the partitioned tables from inspect result. In the meanwhile, please use the exclude flag to ignore this table.

@AnielaN994
Copy link
Author

Hello. It's not only this tables, we have more tables like this and we want their definition to be in the generated schema.sql via inspect in order to execute the script on other databases and for the moment we can exclude the partition schemes until they will be supported but we cannot exclude the tables themselves.

@a8m a8m added the MSSQL label Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants