Skip to content

Can't qualify a user defined type reference #8836

@lukaseder

Description

@lukaseder

What happens?

When I create a user defined type in its own schema, I can't cast to it or reference it from a table

To Reproduce

Create this schema:

create schema s1;
create type s1.x as struct (i int);

Now try to reference the struct:

create schema s2;
create table s2.t (x s1.x);
select cast(row(1) as s1.x);

Both CREATE TABLE and SELECT will fail with a similar error:

SQL Error: java.sql.SQLException: Parser Error: syntax error at or near "."
LINE 1: create table s2.t (x s1.x)
                               ^

And

SQL Error: java.sql.SQLException: Parser Error: syntax error at or near "."
LINE 1: select cast(row(1) as s1.x)
                                ^

If I don't qualify the type identifer, I'm getting a funny error message:

SQL Error: java.sql.SQLException: Catalog Error: Type with name x does not exist!
Did you mean "s1.x"?

This works as a workaround:

set schema = s1;
create table s2.t (x x);
select cast(row(1) as x);

OS:

Microsoft Windows [Version 10.0.22621.2134]

DuckDB Version:

v0.8.2-dev4025

DuckDB Client:

JDBC

Full Name:

Lukas Eder

Affiliation:

Data Geekery

Have you tried this on the latest main branch?

I have tested with a main build

Have you tried the steps to reproduce? Do they include all relevant data and configuration? Does the issue you report still appear there?

  • Yes, I have

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions