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