X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 23064D1DB59 for ; Tue, 16 Mar 2004 04:02:31 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 01509-08 for ; Tue, 16 Mar 2004 00:02:29 -0400 (AST) Received: from hotmail.com (bay8-f86.bay8.hotmail.com [64.4.27.86]) by svr1.postgresql.org (Postfix) with ESMTP id 53F7ED1DB78 for ; Tue, 16 Mar 2004 00:02:28 -0400 (AST) Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Mon, 15 Mar 2004 20:02:24 -0800 Received: from 202.134.76.102 by by8fd.bay8.hotmail.msn.com with HTTP; Tue, 16 Mar 2004 04:02:24 GMT X-Originating-IP: [202.134.76.102] X-Originating-Email: [thomasleung@hotmail.com] X-Sender: thomasleung@hotmail.com From: "Thomas Leung" To: pgsql-admin@postgresql.org Subject: create function problem Date: Tue, 16 Mar 2004 12:02:24 +0800 Mime-Version: 1.0 Content-Type: text/plain; format=flowed Message-ID: X-OriginalArrivalTime: 16 Mar 2004 04:02:24.0839 (UTC) FILETIME=[7D538D70:01C40B0B] X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200403/249 X-Sequence-Number: 12818 I want to index my table using the year of the date. So I create the following function. create function to_year(date) returns varchar as ' declare str varchar; begin str := to_char($1, "YYYY"); return str; end; ' language 'plpgsql' with (iscachable, isstrict); But I face the problem as follow select to_year(current_date); WARNING: Error occurred while executing PL/pgSQL functions to_year WARNING: line 4 at assignment ERROR: Attribute "YYYY" not found Anybody can help? Thanks. _________________________________________________________________ Linguaphone : Learning English? Get Japanese lessons for FREE http://go.msnserver.com/HK/30476.asp