Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 571331337BA4 for ; Fri, 25 Feb 2011 14:34:09 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 55743-05 for ; Fri, 25 Feb 2011 18:34:02 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pz0-f46.google.com (mail-pz0-f46.google.com [209.85.210.46]) by mail.postgresql.org (Postfix) with ESMTP id B3A9A1337B61 for ; Fri, 25 Feb 2011 14:34:01 -0400 (AST) Received: by pzk35 with SMTP id 35so293892pzk.19 for ; Fri, 25 Feb 2011 10:34:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to:content-type :content-transfer-encoding; bh=QOQsdU56g1Jd6TPZ6XEncay1a5TcJpVkvimKW24gXxk=; b=fs50o+alWmjttZ39pAURJw6SSIYjFdxGumJQIS2RE5rOHETV/x04ZSV+uFqU5+lJV/ A7uqcXqfhPRouoPQfTx9tiZve9SYJPw9sayfSKx7XJ31JV5F4+h8Up3EXTO6ynVpAr2d qtv2X3QJ60T2LMJTkmSB+d7iCA+I5dqW/3BfY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; b=fKatTdBRyqX1ATU4B8rQIa8+ERisbpxxS5ipN4McZN1OP8dG/0kSpgtZEMUH4ezvqD jNfrqTwanb6fbpA6c38mP/W8U5+0FsM9WVAZSwv2oFeh82lhbQZ+yY6wZyVF8OT3nVUM 9uJCYFOYQ3CtI3JzGPVhBRy9aoIhznuIZDmao= Received: by 10.142.240.4 with SMTP id n4mr1892970wfh.211.1298658840919; Fri, 25 Feb 2011 10:34:00 -0800 (PST) Received: from [192.168.0.106] (c-24-17-179-185.hsd1.wa.comcast.net [24.17.179.185]) by mx.google.com with ESMTPS id s41sm1317126wfc.3.2011.02.25.10.33.59 (version=SSLv3 cipher=OTHER); Fri, 25 Feb 2011 10:34:00 -0800 (PST) Message-ID: <4D67F615.5060909@gmail.com> Date: Fri, 25 Feb 2011 10:33:57 -0800 From: Adrian Klaver User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7 MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Re: what's wrong in this procedure? References: <080608d1-b5ea-4b40-8042-f21867f97cc8@glegroupsg2000goo.googlegroups.com> In-Reply-To: <080608d1-b5ea-4b40-8042-f21867f97cc8@glegroupsg2000goo.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.589 tagged_above=-5 required=5 tests=BAYES_00=-1.9, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, T_TO_NO_BRKTS_FREEMAIL=0.01 X-Spam-Level: X-Archive-Number: 201102/123 X-Sequence-Number: 35199 On 02/25/2011 09:46 AM, Camaleon wrote: > This error is returned Erro de SQL: > > ERROR: column "Aguardando Pagto" does not exist at character 352>>> > > > create or replace function get_historico() RETURNS SETOF twiste.type_cur__historico AS ' > > SELECT o.data_fim, sum(t.num_itens * t.valor) AS total, count(t.*) AS transacoes > FROM ofertas o > JOIN transacao t ON o.ofertas_id = t.ofertas_id > JOIN municipio m ON o.municipio_id = m.municipio_id > WHERE o.data_fim<= now() AND t.status IN("Aguardando Pagto", "Em análise", "Aprovado", "Completo") > GROUP BY o.data_fim; > ' > language 'sql'; > > > >>> the column is t.status and not "Aguardando Pagto"; >>> what's wrong ? thanks > Try single quotes, 'Aguardando Pagto' -- Adrian Klaver adrian.klaver@gmail.com