简体   繁体   English

redshift 不会创建没有模式绑定的视图,内部有递归 cte

[英]redshift does not create view with no schema binding with recursive cte inside

what's the problem有什么问题

i am trying to create a view in aws redshift with recursive cte inside it and with no schema binding option, but i recieve error like there is no such tables that i create a view over.我正在尝试在 aws redshift 中创建一个视图,其中包含递归 cte,并且with no schema binding选项,但我收到错误消息,就像没有这样的表可以创建视图。

[0A000] ERROR: All the relation names inside should be qualified when creating VIEW WITH NO SCHEMA BINDING.

does anybody know any workaround?有人知道任何解决方法吗? i need the view to be with no schema binding and i would really love to have it我需要没有模式绑定的视图,我真的很想拥有它

how to reproduct the error如何重现错误

create table some_stuff as select 1 as id;

create view stuff_recursive as (
    WITH RECURSIVE
    cte (id, inc) as (
        select id, 0 as inc from some_stuff
        UNION ALL
        select d.id, inc + 1 from some_stuff as d, cte
        where d.id = cte.id
        and inc < 5
        )
    select * From cte
)
WITH NO SCHEMA BINDING
;

additional info附加信息

my current redshift version我当前的红移版本

PostgreSQL 8.0.2 on i686-pc-linux-gnu, 
compiled by GCC gcc (GCC) 3.4.2 20041017 (Red Hat 3.4.2-6.fc3),
Redshift 1.0.34928

The tables in your query must all be qualified with the schema.查询中的表必须全部符合架构。

create table MYSCHEMA.some_stuff as select 1 as id;

create view stuff_recursive as (
    WITH RECURSIVE
    cte (id, inc) as (
        select id, 0 as inc from MYSCHEMA.some_stuff
        UNION ALL
        select d.id, inc + 1 from MYSCHEMA.some_stuff as d, cte
        where d.id = cte.id
        and inc < 5
        )
    select * From cte
)
WITH NO SCHEMA BINDING
;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM