Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 9F9941337BC3 for ; Fri, 25 Feb 2011 17:40:07 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 26635-04 for ; Fri, 25 Feb 2011 21:40:01 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from out02.mta.xmission.com (out02.mta.xmission.com [166.70.13.232]) by mail.postgresql.org (Postfix) with ESMTP id EEA561337BCA for ; Fri, 25 Feb 2011 17:39:59 -0400 (AST) Received: from in02.mta.xmission.com ([166.70.13.52]) by out02.mta.xmission.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.69) (envelope-from ) id 1Pt5OI-0000Bu-Hz; Fri, 25 Feb 2011 14:39:58 -0700 Received: from [208.187.158.94] (helo=[172.16.1.114]) by in02.mta.xmission.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.69) (envelope-from ) id 1Pt5OD-0002vd-OF; Fri, 25 Feb 2011 14:39:58 -0700 Message-ID: <4D6821A0.7030202@gmail.com> Date: Fri, 25 Feb 2011 14:39:44 -0700 From: Rob Sargent User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20101125 SUSE/3.0.11 Lightning/1.0b1 Thunderbird/3.0.11 MIME-Version: 1.0 To: pgsql-sql@postgresql.org 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 Content-Transfer-Encoding: 8bit X-XM-SPF: eid=; ; ; mid=; ; ; hst=in02.mta.xmission.com; ; ; ip=208.187.158.94; ; ; frm=robjsargent@gmail.com; ; ; spf=neutral X-XM-AID: U2FsdGVkX19x8J9rcPOKl0E52xqokXja9KzDkf0fCbE= X-SA-Exim-Connect-IP: 208.187.158.94 X-SA-Exim-Mail-From: robjsargent@gmail.com X-Spam-DCC: XMission; sa02 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ;pgsql-sql@postgresql.org X-Spam-Relay-Country: Subject: Re: what's wrong in this procedure? X-SA-Exim-Version: 4.2.1 (built Fri, 06 Aug 2010 16:31:04 -0600) X-SA-Exim-Scanned: Yes (on in02.mta.xmission.com) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.889 tagged_above=-5 required=5 tests=BAYES_00=-1.9, FREEMAIL_FROM=0.001, T_TO_NO_BRKTS_FREEMAIL=0.01 X-Spam-Level: X-Archive-Number: 201102/126 X-Sequence-Number: 35202 On 02/25/2011 10: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 > Single quotes (') not double quotes (")