Hallo,
Ich bin ueberrascht, dass
select date_trunc('month', '2014-04-01'::DATE)
ein TIMESTAMP WITH TIME ZONE liefert, ein
select date_trunc('month', '2014-04-01'::TIMESTAMP)
hingegen einen ohne. Und weiter:
CREATE INDEX ix_foo_month ON foo ( date(date_trunc('month', foo)) );
Ergebenis: functions in index expression must be marked IMMUTABLE
Warum das? Ich caste doch nach DATE! So hingegen, funktioniert’s:
CREATE INDEX ix_foo_month ON foo ( date(date_trunc('month', foo::TIMESTAMP)) );
Kann mir das jemand erklaeren?
Vielen Dank!