pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #5852: Function date_trunc is not IMMUTABLE
3+ messages / 3 participants
[nested] [flat]

* BUG #5852: Function date_trunc is not IMMUTABLE
@ 2011-01-27 11:02 Oleg <serovov@gmail.com>
  2011-01-27 13:26 ` Re: BUG #5852: Function date_trunc is not IMMUTABLE hubert depesz lubaczewski <depesz@depesz.com>
  2011-01-27 14:40 ` Re: BUG #5852: Function date_trunc is not IMMUTABLE Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 2 replies; 3+ messages in thread

From: Oleg @ 2011-01-27 11:02 UTC (permalink / raw)
  To: pgsql-bugs


The following bug has been logged online:

Bug reference:      5852
Logged by:          Oleg
Email address:      serovov@gmail.com
PostgreSQL version: 8.3
Operating system:   CentOS
Description:        Function date_trunc is not IMMUTABLE
Details: 

Please mark function date_trunc as IMMUTABLE for using in index.

Thanks!



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #5852: Function date_trunc is not IMMUTABLE
  2011-01-27 11:02 BUG #5852: Function date_trunc is not IMMUTABLE Oleg <serovov@gmail.com>
@ 2011-01-27 13:26 ` hubert depesz lubaczewski <depesz@depesz.com>
  1 sibling, 0 replies; 3+ messages in thread

From: hubert depesz lubaczewski @ 2011-01-27 13:26 UTC (permalink / raw)
  To: Oleg <serovov@gmail.com>; +Cc: pgsql-bugs

On Thu, Jan 27, 2011 at 11:02:46AM +0000, Oleg wrote:
> 
> The following bug has been logged online:
> 
> Bug reference:      5852
> Logged by:          Oleg
> Email address:      serovov@gmail.com
> PostgreSQL version: 8.3
> Operating system:   CentOS
> Description:        Function date_trunc is not IMMUTABLE
> Details: 
> 
> Please mark function date_trunc as IMMUTABLE for using in index.

it cannot be immutable. please check explanation in here:
http://www.depesz.com/index.php/2010/09/09/why-is-my-index-not-being-used/
search for "immutable".

Best regards,

depesz

-- 
Linkedin: http://www.linkedin.com/in/depesz  /  blog: http://www.depesz.com/
jid/gtalk: depesz@depesz.com / aim:depeszhdl / skype:depesz_hdl / gg:6749007



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #5852: Function date_trunc is not IMMUTABLE
  2011-01-27 11:02 BUG #5852: Function date_trunc is not IMMUTABLE Oleg <serovov@gmail.com>
@ 2011-01-27 14:40 ` Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 0 replies; 3+ messages in thread

From: Tom Lane @ 2011-01-27 14:40 UTC (permalink / raw)
  To: Oleg <serovov@gmail.com>; +Cc: pgsql-bugs

"Oleg" <serovov@gmail.com> writes:
> Please mark function date_trunc as IMMUTABLE for using in index.

The version for timestamp without time zone already is marked immutable.
The version for timestamp with time zone can't be marked immutable,
because it isn't: its behavior depends on the timezone setting.

Depending on what it is you hope to accomplish, you might be able to do
something like this:

regression=# create table t1 (f1 timestamptz);
CREATE TABLE
regression=# create index ii on t1 (date_trunc('day', f1 AT TIME ZONE 'UTC'));
CREATE INDEX

This is immutable because the truncation happens with respect to a fixed
timezone.  (Doesn't have to be UTC, any constant timezone name will do.)

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2011-01-27 14:40 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-01-27 11:02 BUG #5852: Function date_trunc is not IMMUTABLE Oleg <serovov@gmail.com>
2011-01-27 13:26 ` hubert depesz lubaczewski <depesz@depesz.com>
2011-01-27 14:40 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox