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

Inconsistency with introspecting compositeTypes #548

Open
gitrojones opened this issue Mar 26, 2024 · 1 comment
Open

Inconsistency with introspecting compositeTypes #548

gitrojones opened this issue Mar 26, 2024 · 1 comment

Comments

@gitrojones
Copy link
Contributor

Introspection currently works fine if Kanel runs as a non-owner for enum composite types but will fail to introspect non-enum composite types.

For example:

CREATE TYPE enum_test AS ENUM('foo', 'bar');
CREATE TYPE test AS
(
    foo text,
    bar INT
);

Produces:

/** Represents the enum public.enum_test */
export enum EnumTest {
  foo = 'foo',
  bar = 'bar',
}

/** Represents the compositeType public.test */
export interface Test {}

I would expect that types would resolve as long as usage is allowed on that type. Digging in the source, it looks like a variant of

SELECT
    *,
    ('"' || "attribute_udt_schema" || '"."' || "attribute_udt_name" || '"')::regtype as regtype
FROM information_schema.attributes
WHERE udt_schema = <schema_name>
AND udt_name = <type_name>

used to be used for this, which does correctly resolve columns and types.

Any help on this would be appreciated. Being able to compile types using the runtime role is a useful feature of this tool

@kristiandupont
Copy link
Owner

Yeah, that simply looks like a bug. Composite types should create interfaces just like tables and views, as you expect.

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