From: | Hao Wu <hawu(at)vmware(dot)com> |
---|---|
To: | "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
Cc: | Simon Gao <simong(at)vmware(dot)com> |
Subject: | Rewrite view? |
Date: | 2020-08-04 03:55:43 |
Message-ID: | CY4PR0501MB390643D883A44F6B635E3D33A44A0@CY4PR0501MB3906.namprd05.prod.outlook.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi hackers,
When I define a view relevant with `char varying`, it shows the type is casted to text. See,
gpadmin=# CREATE TABLE foobar (a character varying);
CREATE TABLE
gpadmin=# CREATE VIEW fooview AS SELECT * FROM foobar WHERE a::character varying = ANY(ARRAY['foo'::character varying, 'bar'::character varying]);
CREATE VIEW
gpadmin=# \d+ fooview
View "public.fooview"
Column | Type | Collation | Nullable | Default | Storage | Description
--------+-------------------+-----------+----------+---------+----------+-------------
a | character varying | | | | extended |
View definition:
SELECT foobar.a
FROM foobar
WHERE foobar.a::text = ANY (ARRAY['foo'::character varying, 'bar'::character varying]::text[]);
gpadmin=# create view barview as select * from foobar where a=any(array['foo','bar']);
CREATE VIEW
gpadmin=# \d+ barview
View "public.barview"
Column | Type | Collation | Nullable | Default | Storage | Description
--------+-------------------+-----------+----------+---------+----------+-------------
a | character varying | | | | extended |
View definition:
SELECT foobar.a
FROM foobar
WHERE foobar.a::text = ANY (ARRAY['foo'::text, 'bar'::text]);
My question is that is it an expected behavior or not?
Thank you.
Regards,
Hao Wu
From | Date | Subject | |
---|---|---|---|
Next Message | Ian Lawrence Barwick | 2020-08-04 04:39:35 | Re: Clarifying the ImportForeignSchema API |
Previous Message | David Fetter | 2020-08-04 03:07:51 | Clarifying the ImportForeignSchema API |