Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 08A631337BA4 for ; Fri, 25 Feb 2011 14:39:43 -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 70430-03 for ; Fri, 25 Feb 2011 18:39:35 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-ew0-f46.google.com (mail-ew0-f46.google.com [209.85.215.46]) by mail.postgresql.org (Postfix) with ESMTP id 447AD1337B6E for ; Fri, 25 Feb 2011 14:39:35 -0400 (AST) Received: by ewy6 with SMTP id 6so697147ewy.19 for ; Fri, 25 Feb 2011 10:39:34 -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 :cc:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=ATjSDAQUtcSsqH/zpumOWFRzxl6CfsNcfXCnx8uG3Q0=; b=pcGPMocdHQrG0cti2pCFpU3S140Y834z13y0ulpD7lKboWhSeCMLJRdN/76yLnm1X5 sQvljQjJ9HIc28Dz+Fyq34v3fC6halaLj178pCVYkQqvgHKZdS+9AGRs/rYiq61QXJRa wMmME8VqGVjjxmlW0s8Vq54mOfLBd+VPjKXnI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=xp4DKlxF5ZTbODRDuVPRD/+Uwz0oJHD6vkRpa2rcI1o1Th7f61oPsmqa768rdvFfOK hS3ZhGErdqWcuAEo8MIZ8H5Cj4uianplokAJRhvKgdloV9QzntsQmAfbjOWPu7ikkGgF tU9Byq8HLHQXR5sNJ85SutIwi7xB12rxSXkUg= Received: by 10.14.122.79 with SMTP id s55mr2062578eeh.32.1298659162896; Fri, 25 Feb 2011 10:39:22 -0800 (PST) Received: from [0.0.0.0] (5357DA75.cm-6-8d.dynamic.ziggo.nl [83.87.218.117]) by mx.google.com with ESMTPS id t50sm853875eeh.0.2011.02.25.10.39.21 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 25 Feb 2011 10:39:22 -0800 (PST) Message-ID: <4D67F73C.8090608@gmail.com> Date: Fri, 25 Feb 2011 19:38:52 +0100 From: Yeb Havinga User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.2.13) Gecko/20101207 Lightning/1.0b2 Thunderbird/3.1.7 MIME-Version: 1.0 To: Adrian Klaver CC: pgsql-sql@postgresql.org Subject: Re: what's wrong in this procedure? References: <080608d1-b5ea-4b40-8042-f21867f97cc8@glegroupsg2000goo.googlegroups.com> <4D67F615.5060909@gmail.com> In-Reply-To: <4D67F615.5060909@gmail.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.599 tagged_above=-5 required=5 tests=BAYES_00=-1.9, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7 X-Spam-Level: X-Archive-Number: 201102/124 X-Sequence-Number: 35200 On 2011-02-25 19:33, Adrian Klaver wrote: > 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' and also create or replace function get_historico() RETURNS SETOF twiste.type_cur__historico AS $$ instead of create or replace function get_historico() RETURNS SETOF twiste.type_cur__historico AS ' together with the corresponding $$ language 'sql'; instead of ' language 'sql'; at the end regards, Yeb Havinga