X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E05A83A443D for ; Thu, 6 Jan 2005 03:18:52 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 19012-09 for ; Thu, 6 Jan 2005 03:18:07 +0000 (GMT) Received: from hosting.commandprompt.com (unknown [207.173.200.128]) by svr1.postgresql.org (Postfix) with ESMTP id C7B663A444A for ; Thu, 6 Jan 2005 03:15:21 +0000 (GMT) Received: from [192.168.1.20] (clbb-248.saw.net [64.146.135.248]) (authenticated bits=0) by hosting.commandprompt.com (8.12.8/8.12.8) with ESMTP id j063E660010945; Wed, 5 Jan 2005 19:14:07 -0800 Message-ID: <41DCAD0E.8050402@commandprompt.com> Date: Wed, 05 Jan 2005 19:14:22 -0800 From: "Joshua D. Drake" User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: David.Bear@asu.edu Cc: pgsql-admin@postgresql.org Subject: Re: query and stored procedures References: <20050106005024.GK374@asu.edu> In-Reply-To: <20050106005024.GK374@asu.edu> Content-Type: multipart/mixed; boundary="------------070403050809070404080502" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.04 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/33 X-Sequence-Number: 15892 This is a multi-part message in MIME format. --------------070403050809070404080502 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit David Bear wrote: >I'm so totally new to postgresql that I'm not sure how to word this. > > > What you want to do is create a function (store procedure)... You can use plpythonu to do what you want. So you could create something like this: create or replace function check_id(text) returns integer as ... Sincerely, Joshua D. Drake >I want to create a query, that does two things > >1) take input in the form of a string of numbers, and test if > a) is ssn > b) or internal id > >if the string is an ssn, make a second query to another data base, >asking it to convert the ssn to our internal id > >otherwise, > >2) use the id given to query an existing table > >I'm not sure what feature/function postgresql has to help me do this. >I'd like to stick with using python as my language, and I'm guessing >this would be stored procedure, but I'm too new to know. > >Please point me to some good reading. > > > -- Command Prompt, Inc., home of Mammoth PostgreSQL - S/ODBC and S/JDBC Postgresql support, programming shared hosting and dedicated hosting. +1-503-667-4564 - jd@commandprompt.com - http://www.commandprompt.com PostgreSQL Replicator -- production quality replication for PostgreSQL --------------070403050809070404080502 Content-Type: text/x-vcard; charset=utf-8; name="jd.vcf" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="jd.vcf" begin:vcard fn:Joshua Drake n:Drake;Joshua org:Command Prompt, Inc. adr:;;PO Box 215 ;Cascade Locks;OR;97014;US email;internet:jd@commandprompt.com title:Consultant tel;work:503-667-4564 tel;fax:503-210-0334 x-mozilla-html:FALSE url:http://www.commandprompt.com version:2.1 end:vcard --------------070403050809070404080502--