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

database/drives/postgres/parse.go::queryEnums query adds an enum per enum value rather than actual enum #143

Open
oiime opened this issue Dec 22, 2021 · 2 comments

Comments

@oiime
Copy link

oiime commented Dec 22, 2021

The current query:

SELECT      n.nspname, t.typname as type
	FROM        pg_type t
	LEFT JOIN   pg_catalog.pg_namespace n ON n.oid = t.typnamespace
	JOIN        pg_enum e ON t.oid = e.enumtypid
	WHERE       (t.typrelid = 0 OR (SELECT c.relkind = 'c' FROM pg_catalog.pg_class c WHERE c.oid = t.typrelid))
	AND     NOT EXISTS(SELECT 1 FROM pg_catalog.pg_type el WHERE el.oid = t.typelem AND el.typarray = t.oid)
	AND     n.nspname IN (%s)

Would add an entry per each enum value, not for each enum, causing duplication on generation, I'd like to make a PR replacing it with the following:

SELECT n.nspname, t.typname AS type
	FROM pg_type t 
	JOIN pg_catalog.pg_namespace n ON n.oid = t.typnamespace 
	WHERE typtype='e'
	AND n.nspname IN (%s)

Would create a PR for that

oiime added a commit to oiime/gnorm that referenced this issue Dec 22, 2021
@oiime
Copy link
Author

oiime commented May 19, 2022

@natefinch any chance to consider that? seems too minor to keep a fork for

@natefinch
Copy link
Member

Ahh yeah, that looks good, thanks!

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