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

xo is generating thousands of Postgresql Enum golang struct #339

Open
zhany opened this issue Jan 6, 2022 · 0 comments
Open

xo is generating thousands of Postgresql Enum golang struct #339

zhany opened this issue Jan 6, 2022 · 0 comments

Comments

@zhany
Copy link
Contributor

zhany commented Jan 6, 2022

Hi, recently I updated the xo version and found out that xo is generating thousands of postgresql enum golang structs for one postgresql enum.

After a little investigation I figured that after PR #337 this issue appeared. The root cause might be releted to this postgresql query
in models/enum.xo.go (line 18-23):

SELECT  
c.relname AS table_name, t.typname
FROM pg_class c, pg_type t  
JOIN ONLY pg_namespace n ON n.oid = t.typnamespace  
JOIN ONLY pg_enum e ON t.oid = e.enumtypid  
WHERE n.nspname = $1

The pg_class table is added in the query without any join criteria or where criteria, thus it is generating tons of results for one enum type.

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

1 participant