Received: from maia.hub.org (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id EDE16633952 for ; Sat, 23 Jan 2010 02:26:41 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 34948-05 for ; Sat, 23 Jan 2010 06:26:29 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 4C39D6333C1 for ; Sat, 23 Jan 2010 02:26:31 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id o0N6QTWT001721; Sat, 23 Jan 2010 01:26:29 -0500 (EST) To: Kyle Bateman cc: pgsql-sql@postgresql.org Subject: Re: clock command regression in pltcl? In-reply-to: <4B5A7E04.8030905@actarg.com> References: <4B5A7E04.8030905@actarg.com> Comments: In-reply-to Kyle Bateman message dated "Fri, 22 Jan 2010 21:41:40 -0700" Date: Sat, 23 Jan 2010 01:26:28 -0500 Message-ID: <1720.1264227988@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.461 tagged_above=-10 required=5 tests=AWL=0.138, BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 201001/43 X-Sequence-Number: 33579 Kyle Bateman 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