Re: Check type compatibility

Поиск
Список
Период
Сортировка
От Little, Douglas
Тема Re: Check type compatibility
Дата
Msg-id A434C531E37AD442815608A769550D8059422B97FB@EGEXCMB01.oww.root.lcl
обсуждение исходный текст
Ответ на Check type compatibility  (Gianvito Pio <pio.gianvito@gmail.com>)
Список pgsql-sql
Hello,
I believe types are compatible if they can be cast automatically.
The pg_cast table record all possible casts between types.   If it castcontext is 'a' then I belive it's an automatic
conversionwhich is what I think you want.  'i' implicit means that cast is possible, but must be explicitly cast.  

I suspect that you'll need to write a function that consults the table for the type pair.

Cheers
Doug



-----Original Message-----
From: pgsql-sql-owner@postgresql.org [mailto:pgsql-sql-owner@postgresql.org] On Behalf Of Gianvito Pio
Sent: Saturday, March 06, 2010 5:04 AM
To: pgsql-sql@postgresql.org
Subject: [SQL] Check type compatibility

Hi all,
is there a way to check if two attribute are type compatible (for
example integer and serial, integer and integer, character varying and
text, etc..)?

Example:
IF (compatible (table1.att1, table2.att2)) THEN        ...
ELSE        ...
END IF;

Thanks


--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql


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

Предыдущее
От: Nilesh Govindarajan
Дата:
Сообщение: Re: Check type compatibility
Следующее
От: Louis-David Mitterrand
Дата:
Сообщение: Re: an aggregate to return max() - 1 value?