Re: clock command regression in pltcl?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Kyle Bateman <kyle(at)actarg(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: clock command regression in pltcl?
Date: 2010-01-23 06:26:28
Message-ID: 1720.1264227988@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Kyle Bateman <kyle(at)actarg(dot)com> writes:
> I have the following function defined:
> create function _date_week(int4,int4,int4) returns text language pltcl
> immutable as $$
> return [clock format [clock scan "$2/$3/$1"] -format "%U"]
> $$;

> It worked fine in 8.3 but in 8.4 now I try to build an index using the
> function and get:

> (empl_id,(date_week(wdate)));: ERROR: invalid command name "clock"

Are you using the same underlying version of tcl as before?

What I'm seeing is that tcl seems to have dropped "clock" from the set
of commands considered "safe" between tcl 8.4 and 8.5 --- with 8.5
you can only get at it in pltclu. The version of PG isn't relevant.

I am not sure if this is a bug or an intentional change on their part.
Apparently "clock" was completely rewritten in 8.5, with a lot more
features, which could mean it's not safe anymore. But I don't see
any explicit acknowledgement in the release notes that it's now
considered unsafe.

regards, tom lane

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2010-01-23 06:50:12 Re: clock command regression in pltcl?
Previous Message Kyle Bateman 2010-01-23 04:41:40 clock command regression in pltcl?