From: | Marc Mamin <M(dot)Mamin(at)intershop(dot)de> |
---|---|
To: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Problem with ALTER TYPE, Indexes and cast |
Date: | 2015-07-08 10:29:47 |
Message-ID: | B6F6FD62F2624C4C9916AC0175D56D8828BF11F3@jenmbs01.ad.intershop.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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 varchar type.
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
From | Date | Subject | |
---|---|---|---|
Next Message | John McKown | 2015-07-08 11:47:47 | Re: [pg_hba.conf] publish own Python application using PostgreSQL |
Previous Message | Karsten Hilbert | 2015-07-08 08:55:58 | Re: [pg_hba.conf] publish own Python application using PostgreSQL |