Re: Assignment of valid collation for SET operations on queries with UNKNOWN types.
От | Michael Paquier |
---|---|
Тема | Re: Assignment of valid collation for SET operations on queries with UNKNOWN types. |
Дата | |
Msg-id | CAB7nPqROaTfGd6RvJpKudfpPcf_omK5ptGAgb-EF74wKt9egaw@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Assignment of valid collation for SET operations on queries with UNKNOWN types. (Rahila Syed <rahilasyed90@gmail.com>) |
Ответы |
Re: Assignment of valid collation for SET operations on
queries with UNKNOWN types.
Re: [HACKERS] Assignment of valid collation for SET operations onqueries with UNKNOWN types. |
Список | pgsql-hackers |
On Tue, Dec 6, 2016 at 10:42 PM, Rahila Syed <rahilasyed90@gmail.com> wrote: > Hello, > >>And ideally fix things so >>that the type of the view column will be resolved as text, so that you >>don't hit this condition in the first place; but there is no good that >>comes out of allowing a view to be created like this > > Thank you for suggestion. Attached is a patch which resolves the columns > with literal constants as TEXT for view creation. > > Following views can be created with literal columns resolved as TEXT. > > postgres=# create view v as select 'abc' a; > CREATE VIEW > postgres=# create view v1 as select 'def' a; > CREATE VIEW There is a similar code pattern for materialized views, see create_ctas_nodata() where the attribute list is built. Even with your patch, I get that: =# create materialized view m as select 'abc' a; WARNING: 42P16: column "a" has type "unknown" DETAIL: Proceeding with relation creation anyway. LOCATION: CheckAttributeType, heap.c:499 SELECT 1 Time: 6.566 ms =# select * from m order by 1; ERROR: XX000: failed to find conversion function from unknown to text Your patch has no regression tests, surely you want some to stress this code path. And actually, shouldn't this be just a plain error? -- Michael
В списке pgsql-hackers по дате отправления: