X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id CDB25D1E9B0 for ; Tue, 23 Mar 2004 09:10:55 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 32217-03 for ; Tue, 23 Mar 2004 05:10:55 -0400 (AST) Received: from main.gmane.org (main.gmane.org [80.91.224.249]) by svr1.postgresql.org (Postfix) with ESMTP id 5B6B8D1E1DD for ; Tue, 23 Mar 2004 05:10:53 -0400 (AST) Received: from list by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 1B5hvx-0006f8-00 for ; Tue, 23 Mar 2004 10:10:53 +0100 Received: from 24-151-240-198.chartertn.net ([24.151.240.198]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 23 Mar 2004 10:10:53 +0100 Received: from dbase4 by 24-151-240-198.chartertn.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 23 Mar 2004 10:10:53 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-odbc@postgresql.org From: "David P. Lurie" Subject: postgresql equivalent to ms access parameter query Date: Tue, 23 Mar 2004 04:11:05 -0500 Lines: 41 Message-ID: X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: 24-151-240-198.chartertn.net X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200403/70 X-Sequence-Number: 3872 What is the postgresql equivalent to an ms access 2002 parameter query? Postgresql functions written in SQL that return sets from select queries seem closest. Table stores has columns of storeid, name, address, etc. A postgresql SQL procedure retrieves records based on a single column parameter: CREATE OR REPLACE FUNCTION public.state(varchar) RETURNS SETOF stores AS ' SELECT * from stores where stateorprovince = $1; ' LANGUAGE 'sql' VOLATILE; The following SQL statement runs as expected from psql or the pgAdminIII query window: SELECT storeid,storename from state('TN'); How is a parameter passed from access to postgresql in a pass-through query calling a function? A standard access query (non pass-through) to the postgresql table can reference a text box control on a form: SELECT public_stores.storeid, public_stores.storename, public_stores.address, public_stores.city, public_stores.stateorprovince, public_stores.postalcode FROM public_stores WHERE (((public_stores.stateorprovince)=[Forms]![Form1]![Text0])); Thanks, David P. Lurie