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

[Bug?] error calling MarshalHCL when trying to inspect schema #3397

Open
scoquelin opened this issue Feb 20, 2025 · 3 comments
Open

[Bug?] error calling MarshalHCL when trying to inspect schema #3397

scoquelin opened this issue Feb 20, 2025 · 3 comments

Comments

@scoquelin
Copy link

scoquelin commented Feb 20, 2025

I'm on Windows and trying to inspect a Postgres schema using :

.\atlas.exe schema inspect -u "postgres://babelfish_user:<password>@localhost:5432/babelfish_db?search_path=dbo&sslmode=disable"

and I get this error ⚠ :

Error: template: inspect:1:4: executing "inspect" at <$.MarshalHCL>: error calling MarshalHCL: must not call ListVal with empty slice

Also tried :

.\atlas.exe schema inspect -u "postgres://babelfish_user:<password>@localhost:5432/babelfish_db?sslmode=disable" -s dbo

and get the same error.

However, when I request SQL or JSON format using respectively :

.\atlas.exe schema inspect -u "postgres://babelfish_user:<password>@localhost:5432/babelfish_db?search_path=dbo&sslmode=disable" --format "{{ sql . }}" > script.sql
or
.\atlas.exe schema inspect -u "postgres://babelfish_user:<password>@localhost:5432/babelfish_db?search_path=dbo&sslmode=disable" --format "{{ json . }}" > script.json it works fine! 🤔

Any idea what could be wrong with the HCL generation? Thanks!

.\atlas.exe version
atlas version v0.31.1-2f66f82-canary
https://github.com/ariga/atlas/releases/latest
@scoquelin scoquelin changed the title [Bug] error calling MarshalHCL when trying to inspect schema [Bug?] error calling MarshalHCL when trying to inspect schema Feb 20, 2025
@a8m
Copy link
Member

a8m commented Feb 20, 2025

I assume this is AWS Babelfish, right?

There might be some differences between PostgreSQL and Babelfish-PG. Can you please share the SQL result you got? I will try to reproduce this.

@scoquelin
Copy link
Author

scoquelin commented Feb 20, 2025

Yes it is, but I am using https://github.com/jonathanpotts/docker-babelfishpg to spin up Babelfish locally.

After trying their example script I was actually able to extract the HCL using :

.\atlas.exe schema inspect -u "postgres://babelfish_user:<password>@localhost:5432/babelfish_db?search_path=master_example_db&sslmode=disable" > example_db.hcl

so the issue must be related to my other dbo schema. Unfortunately I cannot share the SQL output because this is proprietary info but will appreciate any help that could help me isolate the issue. I will try to use exclusions to see if that helps.

Thanks!

@scoquelin
Copy link
Author

Was able to narrow down the issue. HCL generation works in my dbo schema when I exclude index :

.\atlas.exe schema inspect -u "postgres://babelfish_user:<password>@localhost:5432/babelfish_db?search_path=dbo&sslmode=disable" --exclude '*.*[type=index]'

I will see if I can point exactly what index is causing the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants