Unnecessary casts in pg_cast

Поиск
Список
Период
Сортировка
От Gregory Stark
Тема Unnecessary casts in pg_cast
Дата
Msg-id 87bq9yjl2l.fsf@oxford.xeocode.com
обсуждение исходный текст
Ответы Re: Unnecessary casts in pg_cast  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
postgres=# select *,(select typname from pg_type where oid = castsource) as source,(select typname from pg_type where
oid= casttarget) as target from pg_cast where castsource = 25 or casttarget = 25;castsource | casttarget | castfunc |
castcontext| source  |  target  
 
------------+------------+----------+-------------+---------+----------        25 |       2205 |     1079 | i
|text    | regclass        25 |       1042 |        0 | i           | text    | bpchar        25 |       1043 |
0| i           | text    | varchar      1042 |         25 |      401 | i           | bpchar  | text      1043 |
25|        0 | i           | varchar | text        18 |         25 |      946 | i           | char    | text        19
|        25 |      406 | i           | name    | text        25 |         18 |      944 | a           | text    | char
     25 |         19 |      407 | i           | text    | name       650 |         25 |      730 | a           | cidr
| text       869 |         25 |      730 | a           | inet    | text        16 |         25 |     2971 | a
|bool    | text       142 |         25 |     2922 | a           | xml     | text        25 |        142 |     2896 | e
        | text    | xml
 
(14 rows)


Why do we need assignment casts from cidr, inet, bool, and xml to text? These
all seem redundant since there's effectively an assignment cast from every
data type to text anyways:


postgres=# delete from pg_cast where casttarget = 25;
DELETE 8

postgres=# insert into t values ('1.0.0.0'::cidr);
INSERT 0 1

postgres=# select * from t;    t      
------------1.0.0.0/32
(1 row)

postgres=# \d t    Table "public.t"Column | Type | Modifiers 
--------+------+-----------t      | text | 

--  Gregory Stark EnterpriseDB          http://www.enterprisedb.com Ask me about EnterpriseDB's Slony Replication
support!


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Gregory Stark
Дата:
Сообщение: Re: Simplifying Text Search
Следующее
От: rjalster@rockwellcollins.com
Дата:
Сообщение: New to PostgreSQL