Problem with ALTER TYPE, Indexes and cast

Поиск
Список
Период
Сортировка
От Marc Mamin
Тема Problem with ALTER TYPE, Indexes and cast
Дата
Msg-id B6F6FD62F2624C4C9916AC0175D56D8828BF11F3@jenmbs01.ad.intershop.net
обсуждение исходный текст
Ответы Re: Problem with ALTER TYPE, Indexes and cast  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Hello,

I plan to replace some btree indexes through btree_gin on some timed tables(e.g. monthly tables)
For this, I first need to change the data type from character(n) to varchar,
but I can't afford it on historical tables as this would be too time consuming, so only new tables should get the
varchartype. 

Now I have generated queries that include cast information in order to ensure that the indexes get used.

e.g.:  WHERE month1.foo = cast('XY' as character(2))

with mixed type, this should become something like:

 SELECT ... FROM month1
 WHERE month1.foo = cast('XY' as character(2))
 UNION ALL
 SELECT... FROM month2
 WHERE month2.foo = cast('XY' as varchar)

 which is quite complicated to resolve in our "query builder framework"


 There seems to be no way to have dynamic casting, something like:

  WHERE month2.foo = cast('XY' as 'month2.foo'::regtype)

 Is there a way for it ?


 regards,
 Marc Mamin


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

Предыдущее
От: Karsten Hilbert
Дата:
Сообщение: Re: [pg_hba.conf] publish own Python application using PostgreSQL
Следующее
От: John McKown
Дата:
Сообщение: Re: [pg_hba.conf] publish own Python application using PostgreSQL