Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 274E39FB45F for ; Fri, 30 Mar 2007 16:19:47 -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 62374-06 for ; Fri, 30 Mar 2007 16:19:34 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from wx-out-0506.google.com (wx-out-0506.google.com [66.249.82.230]) by postgresql.org (Postfix) with ESMTP id 3BBCE9FB30F for ; Fri, 30 Mar 2007 16:19:37 -0300 (ADT) Received: by wx-out-0506.google.com with SMTP id i28so642707wxd for ; Fri, 30 Mar 2007 12:19:35 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=uWIJ/Ajopdfq5/U52E/cg7Ys7dIYEVTY7MKtIqo88N2IYF6HJhmpAFNK3Stz3O67+8qdZwXWAH1N5lZmlmyEE8XYb0PpGx3g79zpdSzYn7j6I3dUjKzH/vC0xzhmW2pNJ4AMY2Vt4KThCKsWJjpbPgQAS0qmSzIA0b5fHVBZkNI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=Ty9M+X6E6ZXRmaq2Rp+I04xzle0wS1Ij2zn8HblfnaQDJiTX5zpqtQPiMIS6KWr2YtJlh05p2sr17vgnU0gO00OEJuoQJiFWPpRtr/VPAm4JoPyDkmi9wCBDryoilGgegVOzkHX+f4WFITJY6atSrrqwAfsEsmLupKtBy5ecCsY= Received: by 10.70.32.6 with SMTP id f6mr4332708wxf.1175282374922; Fri, 30 Mar 2007 12:19:34 -0700 (PDT) Received: by 10.90.117.3 with HTTP; Fri, 30 Mar 2007 12:19:34 -0700 (PDT) Message-ID: <68b897d90703301219p5a891976wf3f0baefc5f85551@mail.gmail.com> Date: Fri, 30 Mar 2007 13:19:34 -0600 From: "Brian Jarrett" To: pgsql-sql@postgresql.org Subject: using sql on v7.4 server to feed stored procedure MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200703/358 X-Sequence-Number: 27996 I just found out that I posted this to the wrong list before, so if this ends up as a cross-post, I'm sorry. I've created some sql scripts to update a database in version 8.x and now I'm trying to get them to run on servers using v7.4 The following statement works on 8.x servers, but not on 7.4 and I can't figure out how to get it to operate in the earlier version: select calc_cum_gpa_mp(marking_period_id::TEXT) from (select distinct marking_period_id from student_mp_stats) as sms1; I get the error: ERROR: syntax error at or near "(" SQL state: 42601 Context: compile of PL/pgSQL function "calc_cum_gpa_mp" near line 8 Can anyone point me in the right direction? I've searched everywhere for how to use stored procedures in sql queries, and haven't found how to use the subquery to feed values to the stored procedure. It almost looks like I'd need to create another plpgsql function with a loop to do the same thing. Brian