Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 9ACFA9FBA17; Mon, 18 Jun 2007 11:30:04 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 05982-01-3; Mon, 18 Jun 2007 11:29:51 -0300 (ADT) X-Greylist: delayed 01:15:10.658666 by SQLgrey-1.7.4 X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from sr04-04.mta.terra.com.br (sr04-04.mta.terra.com.br [200.154.152.53]) by postgresql.org (Postfix) with ESMTP id 600BF9FB722; Mon, 18 Jun 2007 11:29:56 -0300 (ADT) Received: from peguis.hst.terra.com.br (peguis.hst.terra.com.br [200.176.10.32]) by buniche.hst.terra.com.br (Postfix) with ESMTP id 1D80A900191; Mon, 18 Jun 2007 11:29:54 -0300 (BRT) X-Terra-Karma: -2% X-Terra-Hash: 6f1d59190f130ebfa4951037839e141a Received-SPF: pass (peguis.hst.terra.com.br: domain of terra.com.br designates 200.176.10.32 as permitted sender) client-ip=200.176.10.32; envelope-from=ranieri.oliveira@terra.com.br; helo=[172.16.2.72]; Received: from [172.16.2.72] (200-162-219-207.corp.ajato.com.br [200.162.219.207]) (authenticated user ranieri.oliveira) by peguis.hst.terra.com.br (Postfix) with ESMTP id AB8CA2C049; Mon, 18 Jun 2007 11:29:52 -0300 (BRT) Message-ID: <467696D7.2090703@terra.com.br> Date: Mon, 18 Jun 2007 11:29:43 -0300 From: Ranieri Mazili User-Agent: Thunderbird 2.0.0.4 (Windows/20070604) MIME-Version: 1.0 To: pgsql-general@postgresql.org, pgsql-sql@postgresql.org Subject: Setting variable Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.702 tagged_above=0 required=5 tests=AWL=-0.207, BAYES_50=0.001, DNS_FROM_RFC_ABUSE=0.2, DNS_FROM_RFC_POST=1.708, UPPERCASE_25_50=0 X-Spam-Level: * X-Archive-Number: 200706/1044 X-Sequence-Number: 115867 Hello, I need to know why can't I do it? CREATE OR REPLACE FUNCTION lost_hours_temp(date) RETURNS text AS $BODY$ DECLARE START_DATE date; END_DATE date; QUERY text; BEGIN START_DATE := $1; END_DATE := START_DATE - interval '3 year'; The last line (END_DATE := START_DATE - interval '3 year';) generate the following error: ERROR: operator is not unique: "unknown" / "unknown" SQL state: 42725 Hint: Could not choose a best candidate operator. You may need to add explicit type casts. Context: PL/pgSQL function "lost_hours_temp" line 10 at assignment How can I solve it? Thanks